-1

HTMLコードの文字列があります。このhtmlコード内に、htmlコードを小さなチャンクに分割するのに役立ついわゆる「html区切り文字」があります。

区切り文字は次の形式です。

<br class="limit" />

htmlコードは以下の通りです

<p>To be A Premier in Global Distinction<br class="limit" />To be A Premier Polytechnic of Global Distinction&nbsp;<br class="limit" />We provide quality education and training to prepare students and adult learners for work and life, equipping them to be life-long learners <br class="limit" />We will harness our resources, expertise, creativity and innovation to support the development of business and industry.</p>    

これは私のphpコードです

$htmlparts = explode("<br class='limit' />", $htmlcode);
echo $htmlparts [0];
echo $htmlparts [1];
echo $htmlparts [2];

正しくは$htmlparts[0]は私を返すはずです

Global Distinctionのプレミアになるには、$htmlparts[1]が私をGlobalDistinctionのプレミアポリテクニックになるように返す必要があります。

それによって分割に失敗します。専門家のアドバイスに感謝します。ありがとう!

4

1 に答える 1

4

"limit"あなたが爆発しようとしている間、あなたのhtmlサンプルは持っています'limit'-引用スタイルの違いに注意してください。Explodeでは、区切り文字が完全に一致している必要があります。異なる引用符を使用しているため、一致することはなく、爆発することもありません。

于 2012-05-07T04:09:43.310 に答える