php分开每个字,PHP,分解每个句子之间有特殊字符的文本文件
我有一個帶有Unicode編碼的文本文件(有時它包含一個希伯來語),其內(nèi)容是文本,在每個句子之間有一個像這樣的兩個特殊字符(■■)(alt + 2 + 5 + 4),這是一個示例
"How are you, It's a cool day .. how can I read this sentence in a string variable with the quotes."■■
"This is second sentence I want it in another variable or in second cell in array."■■
This is third sentence. It is without quotes I want to read it to a string.■■
This is fourth sentence it includes an enter,
The fourth sentence isn't completed right yet.
The sentence doesn't completed until the special character is appears,
Maybe there a lot of lines in the same sentence.
This is the last part of the sentence■■
"This is the fifth sentence", this is the second part of the fifth sentence■■
Maybe between every two sentences there is a lot of empty lines, This is the sixth sentence■■
Thanks I wish anyone can help me with this, This is the last sentence■■我對這個代碼,但它不起作用:
$file=file_get_contents("text_file.txt");
$file_= urldecode($file);
$sentences = explode('■■',$file_);
?>當我為第一句(我沒有把所有文件放在簡單的閱讀文件中)制定指定的代碼時,我會得到
Array ( [0] => ��"How are you, It s a cool day .. how can I read this sentence in a string variable with the quotes."�%�%并獲得相同的其他句子..(我看到在同一行中的所有句子)我的意思是沒有進入
另一件事,我想忽略兩句話之間的界限,我的意思是忽略■■后面的空行
總結(jié)
以上是生活随笔為你收集整理的php分开每个字,PHP,分解每个句子之间有特殊字符的文本文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php url怎么加前缀,php – 在
- 下一篇: php 二叉树判断节点的位置,PHP实现