php分开每个字,PHP,分解每个句子之间有特殊字符的文本文件
我有一个带有Unicode编码的文本文件(有时它包含一个希伯来语),其内容是文本,在每个句子之间有一个像这样的两个特殊字符(■■)(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."�%�%并获得相同的其他句子..(我看到在同一行中的所有句子)我的意思是没有进入
另一件事,我想忽略两句话之间的界限,我的意思是忽略■■后面的空行
总结
以上是生活随笔为你收集整理的php分开每个字,PHP,分解每个句子之间有特殊字符的文本文件的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: php url怎么加前缀,php – 在
- 下一篇: php 二叉树判断节点的位置,PHP实现