php中的子字符串
我有一些html代码php中的子字符串,php,html,substring,Php,Html,Substring,我有一些html代码 <p style="color:red;font-size:12px;">This economy car is great value for money and with the added benefit of air conditioning is ideal for couples and small families. A ?500 excess applies which can be waived to NIL for only <b>
<p style="color:red;font-size:12px;">This economy car is great value for money and with the added benefit of air conditioning is ideal for couples and small families. A ?500 excess applies which can be waived to NIL for only <b>5.00</b> per day</p>
及
但这两种方法都不起作用。第一个返回一个空结果,第二个返回包含所有html代码的sting。
echo (substr(strip_tags($mytext), 0, 25));
这将剥离所有标记,并显示给定字符串的前25个字符
示例:请执行以下操作:
echo (substr(strip_tags($mytext), 0, 25));
这将剥离所有标记,并显示给定字符串的前25个字符
例如:
这将只显示前25个字符,不显示html
这将只显示前25个字符,不显示html,您希望得到什么输出?我只需要前25个字符,即“这辆经济型汽车很好”html不需要,您希望得到什么输出?我只需要前25个字符,即“这辆经济型汽车很好”html不需要从@Armin的答案复制和粘贴。。。?从@Armin的答案复制并粘贴。。。?欧欧欧
echo (substr(strip_tags($mytext), 0, 25));
substr(strip_tags($mytext), 0, 25)