【发布时间】:2018-06-23 15:58:24
【问题描述】:
我在按段落分割字符串时遇到了一些麻烦。
我在 $item->description 中有一个字符串,但它似乎没有做我需要的事情。
我的代码:
$text = explode("</p>", $item->description);
var_dump($text);
它只输出所有文本的位置,而不是进行拆分:
array(1) { [0]=> string(726) "<b>Requirements</b> <p>A zeal towards learning to learn
as a priority. A sound knowledge of Internet and Browsing!</p> <b>Description</b> <p>The
course DIGITAL SKILLS FOR TEACHERS inherits the requirements for being a ROCKSTAR
Teachers with competency towards excellence within classrooms on narration with experience
and making a wow feature a continuous activity in classrooms on priority. The course
modules the expertise to imbibe for all teachers towards excellence with the adoption
of technology in a big very way!</p> <b>Who is the target audience?</b> <p>Any individual
who feels teaching is Sharing. A must for all Educators.</p>" }
有人可以帮助我吗?谢谢!
【问题讨论】:
-
3v4l.org/mB7YW 无法复制
-
测试时对我有用
-
您使用的是什么版本的 PHP?文本可以是 UTF-8 吗?
-
@RiggsFolly 我使用的是 7.2.5 版本并检查了字符串,它给了我 ASCII。