0
我試圖讓我的內容的摘錄 - [...]PHP:通過匹配本作的節選用正則表達式
$content_filtered = preg_replace("/<p>(.*?)\[...\](.*?)<\/p>/is", "<p>$1...</p>[...]<p>$2</p>", $item['pg_content_1']);
,然後爆炸這個[...]
$array_content = explode('[...]', $content_filtered);
生產摘錄,
$content_current = $array_content[0];
它工作正常,當我使用[...]這樣,
<p>Lorem Ipsum is simply dummy text of[...] the printing and typesetting industry.</p>
會產生這樣的事情,
Lorem Ipsum is simply dummy text of...
但如果我之前把白色空間[...],
<p>Lorem Ipsum is simply dummy text of [...] the printing and typesetting industry.</p>
那麼點會有一個空白在摘錄中,
Lorem Ipsum is simply dummy text of ...
我怎樣才能擺脫那個空白?
我想我必須在這行下面的正則表達式的東西,但我不知道如何!
preg_replace("/<p>(.*?)\[...\](.*?)<\/p>/is", "<p>$1...</p>[...]<p>$2</p>", $item['pg_content_1']);
如果您有任何意見,請讓我知道!
謝謝。
非常感謝你的幫助忽略它! – laukok 2011-01-20 00:40:56