html中的子字符串 [英] substring in html

查看:21
本文介绍了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>5.00</b> per day</p>

使用以下两种方法

substr($mytext,0,25);

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

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

need to get the first 50 chars...anybody please help

谢谢

推荐答案

希望这是有效的...试试

Hope this is working... Just try

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

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

这篇关于html中的子字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆