如何在前100個字符後添加<br />
?我的意思是打破一次,而不是每100個字符後加<br />
。php僅在前100個字符後添加<br />
$str="Apple has announced that co-founder, former CEO and chairman of the board Steve Jobs has passed away at the age of 56, so we take a look back at the famous innovator's life.At left, Steve Jobs, chairman of the board of Apple Computer, leans on the new 'Macintosh' personal computer following a shareholder's meeting Jan. 24, 1984, in Cupertino, Calif. The Macintosh was priced at $2,495.";
//echo substr($str, 0, 100).'<br />'; this will break sentence after 100 characters.
//echo wordwrap($str, 100, "\n<br />\n");this will add <br /> after each 100 characters.
而我需要的是:
Apple has announced that co-founder, former CEO and chairman of the board Steve Jobs has passed away
<br /> <-- only add here.
at the age of 56, so we take a look back at the famous innovator's life.At left, Steve Jobs, chairman of the board of Apple Computer, leans on the new 'Macintosh' personal computer following a shareholder's meeting Jan. 24, 1984, in Cupertino, Calif. The Macintosh was priced at $2,495.
會的'$值str'有哪些字符集編碼? UTF-8? –
UTF-8。所有英文單詞。 – cj333