去除html标签 php
function my_html($string,$sublen =80){
$string = strip_tags($string);
$string = preg_replace ('/\n/is', '', $string);
$string = preg_replace ('/ | /is', '', $string);
$string = preg_replace ('/ /is', '', $string);
preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/", $string, $t_string);
if(count($t_string[0]) - 0 > $sublen) $string = join('', array_slice($t_string[0], 0, $sublen))."…";
$string = join('', array_slice($t_string[0], 0, $sublen));
return $string;
}
去除html标签 php的更多相关文章
- PHP 去除HTML标签 HTML实体转字符 br转\n
1.去除HTML标签 strip_tags(string,allow)//剥去字符串中的 HTML 标签,但允许使用 <img> 标签:$str = strip_tags($str,&q ...
- 去除html标签 正则表达式
/// <summary> /// 去除html标签 /// </summary> public static string Clea ...
- WP开发笔记——去除 HTML 标签
获取到一段HTML类型的信息,显示在WP的webbrowser控件中,如果不加处理的话,会显示出各种神烦的HTML标签. 这时,需要我们将这HTML类型的信息进行处理去除HTML标签后再显示出来,这里 ...
- JS、C# 去除html标签
JS去除html标签 var str = "<span style="display:none;" mce_style="display:none;&qu ...
- java正则表达式去除html标签
当我们用ckeditor或其他一些在线文本编辑器的时候 内容里会有很多的标签 如下片段: <p><img alt="" src="/img/upload ...
- asp.net正则表达式去除a标签
if (drr["allow_a"].ToString() == "False") { cont = dr["news_Content"]. ...
- Java中正则表达式去除html标签
Java中正则表达式去除html的标签,主要目的更精确的显示内容,比如前一段时间在做类似于博客中发布文章功能,当编辑器中输入内容后会将样式标签也传入后台并且保存数据库,但是在显示摘要的时候,比如显示正 ...
- 正则去除字符串中的html标签,但不去除<br>标签
一.去除html标签 filterHTMLTag(msg) { var msg = msg.replace(/<\/?[^>]*>/g, ''); //去除HTML Tag msg ...
- C#去除HTML标签
public static string ReplaceHtmlTag(string html, int length = 0) { string strText = System.Text.Regu ...
- 使用Beautifulsoup去除特定标签
使用Beautifulsoup去除特定标签 试用了Beautifulsoup,的确是个神器. 在抓取到网页时,会出现很多不想要的内容,例如<script>标签,利用beautifulsou ...
随机推荐
- Cocos2d-X开发中国象棋《三》開始场景的实现
在前面两节(第一节.第二节)中介绍了中国象棋的功能和project文件.在这篇博客中将介绍中国象棋的開始场景的实现 在写代码前先理清一下实现開始场景的思路: 1.打开游戏后进入開始场景,场景上显示一个 ...
- 关于ajax技术
传统注册存在的弊端 : 当我们点击注册时,会存在以下几个问题. 首先,浏览器会销毁当前页面,如果注册失败返回的新页面所有之前 填写的数据丢失. 其次,如果网络通信较差,我们表单提交请求数据到服务端,而 ...
- This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'的意思是,这版本的 MySQL 不支持使 ...
- c#,Java aes加密
1.c#版本 /// <summary> /// Aes加密解密.c#版 /// </summary> public class BjfxEncryptHelper { /// ...
- [转]rdlc报表中表达式的使用--switch和IIF范例
本文转自:http://hi.baidu.com/oypx1234/item/5b35dec4e03a3ad697445266 =Switch( Fields!MLWHLO.Value = " ...
- Spring Boot (22) Spring Security
除了使用拦截器.过滤器实现对没有权限访问的页面跳转到登陆页外,还可以通过框架实现:Spring Security. 使用Spring Security 完成登陆验证: 1.pom.xml添加依赖 &l ...
- HttpServletResponse对象,自己学习的心得
Web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象,和代表响应response对象. request和response对象既然代表请求和响应,那我们要 ...
- JSON与List之间的转换
jsonString转换为list: JSONArray jsonArray=JSONArray.fromObject(result); List<RentCar> books=(List ...
- [原创]Linux(CentOS)下安装nodejs+express
网上找了很多步骤,各种问题,自己总结下吧 1.下载 wget --no-check-certificate https://nodejs.org/dist/v6.10.1/node-v6.10.1-l ...
- page事件
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Secu ...