php - html中的子字符串

标签 php substring

<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>

使用以下两种方法

substr($mytext,0,25);

 $s = html_entity_decode($mytext);
 $sub = substr($s, 0, 50);�

需要获取前 50 个字符...请帮忙

谢谢

最佳答案

希望这能起作用......试试吧

echo (substr(strip_tags($mytext), 0, 25));

http://www.ideone.com/6TgJX

关于php - html中的子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10210630/

相关文章:

filter - OpenLDAP 2.4.33 上不区分大小写的子字符串 LDAP 搜索

string - 从值字符串中获取值

R函数删除列中的前4个字符?

php - 有教义的解释

php - 更好的管理员安全性

php - 数据库准备语句中的汉字

java - 从右手方向在 JAVA 中使用子字符串

C# 8 从字符串中获取最后 n 个字符的方法

php - CakePHP,使用 HABTM 表

php - 找不到 php_sqlsrv 扩展 - 5.3,线程安全