先将文件读到一个字串,然后
preg_replace('/^<[\\?].*[\\?]>/i','',$o_string);
楼主试试,突然忘记很多正则语法了
preg_replace('/^<[\\?].*[\\?]>/i','',$o_string);
楼主试试,突然忘记很多正则语法了
解决方案 »
- 如何获取登录后跳转的网址,有点难度!!
- 做过工商C2C的请进
- 小问题,100分-_-
- php代码升级问题
- mktime()为什么不能超过2100年?
- 新手维护旧PHP网站,win2k+Apache2.0.55+php5.1.1+mysql5.0.16中文乱码
- PHP检索SQL Server的Image字段,如何突破4K大小的限制?
- 文件上传,在window下能很好的运行,但是在服务器上(linux)出错
- 如何生成指定长度的中文字符串
- 【紧急】float数据如何转换成整数?2.01E+21
- 框架网页,不想让部分框架出现滚动条,如何只让整个网页出现滚动条?
- 有谁能帮我找一篇有关PHP新闻发布系统的毕业论文!
<html><head>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>
<meta name=GENERATOR content=Microsoft FrontPage 4.0>
<meta name=ProgId content=FrontPage.Editor.Document>
这些吗?
这有什么意义呢?不都是你写进去的吗?
是我写进去的啊,,可是现在我想过滤掉,把他做成html页面..而不是php.
就可得到html代码了
* 去掉字符串的html标签
*
* @param string $str 包含html代码的字符串
* @return $text 去掉html标签后的纯洁字符串
*/
function html2txt($str)
{
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA
);
$text = preg_replace($search, '', $str);
return $text;
}