$file_contents = file_get_contents('http://finance.ifeng.com/roll/20100902/2581741.shtml');
$file_contents = preg_replace('/<(?=script|style).*>[^(<script|<style).+]<\/(script|style)>/is', '', $file_contents);
这个正则好像不行呀
$file_contents = preg_replace('/<(?=script|style).*>[^(<script|<style).+]<\/(script|style)>/is', '', $file_contents);
这个正则好像不行呀
解决方案 »
- Fatal error: Call to undefined function oci_connect() 应该要怎么解决
- phpadmin数据插入中文数据报错
- PDF文件延时打开
- windows 下NGINX 做反向代理服务器 不同目录下的HTML缓存时间不同设置
- 求PHP模拟POST,SESSION实例
- 调用函数时如果想使用函数的默认参数,是不是不填写参数就是使用默认的?
- 如果将别人机器上的cookie文件复制到我的电脑上(假设使用相同浏览器),是不是能够登录别人的账号呢?如何防范。
- 请教前辈2个数组输出疑问
- 数据库连接问题!
- PHP的类中的变量在 其中的方法中调用还需用global吗?
- 帮忙看下这段代码吧。。 可以告诉我什么意思最好 感谢
- php 扩展 perl
$file_contents = file_get_contents('http://finance.ifeng.com/roll/20100902/2581741.shtml');
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
);
$newcontents = preg_replace($search, "", $file_contents);
echo $newcontents;
?>