我有串這樣的: Suède · Slovénie
通過特殊字符爆炸·
我需要·
爆發,我嘗試了各種解決方案,如:
preg_split("/[?·]/",strip_tags($single->children(2)->outertext))
explode(chr(149), strip_tags($single->children(2)->outertext));
explode(utf8_encode('·'),strip_tags($single->children(2)->outertext));
explode('·',strip_tags($single->children(2)->outertext));
但沒有解決方案對我的作品!任何人都可以讓我知道嗎?
帽子字符集你使用? Utf-8中的'è'是兩個字節(0xC3,0xA8),'explode()',就像其他PHP字符串函數一樣,可以在字節基礎上工作 – johannes
Preg_split空格點空間?我的意思是任何字符中的點 – Andreas
我認爲你可以教''preg_ *'函數正確操作Unicode字符串(我假設UTF-8)使用'u'標誌,所以'preg_split('/?·]/u',..)'也可以完成這項工作。但是,Marcin建議使用'mb_split()'更好,因爲它更具表現力。 –