求一正则 将<td class="t14l14">....... </td> 里的内容提取出来。 网页地址是 http://www.people.com.cn/GB/historic/0826/, 就是将历史上今天内容给提取出来,PHP写。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $header = array( 'http'=>array( 'header'=>"Connection: keep-alive\r\n" ."Accept-Encoding:gzip, deflate\r\n" ."Pragma:no-cache\r\n" ."Cache-Control:no-cache" ));$result = file_get_contents('http://www.people.com.cn/GB/historic/0826/',false,stream_context_create($header));$result = iconv('gb2312','utf-8//ignore',gzinflate(substr($result,10)));preg_match_all('#<a\s+[^>]*class="anavy"[^>]*>((?:(?!</a>).)*)</a>#is',$result,$m);echo "<pre/>";print_r(array_map('htmlspecialchars',$m[0]));print_r($m[1]); PHP无法对父目录文件操作 XML 文档只能有一个顶层元素 急救 老问题刚解决,新问题来了,来看看我的Php用的哪个数据库? 我想把一条数据的标题、姓名、内容读出来,这样写怎么不行呢,给个意见 php 如何检测用户提交数据大小 请教一个数组的调用方法! 菜鸟级四级连动 LINUX下PHP安装出错,怎么解决? PHP是一种没有前途的嵌入式脚本语 问个关于取得客户端信息的问题。 刷新验证码的时候SESSION 会把以前所有的验证码都记录下来? 苦于备份网站数据库相当麻烦,还要去ftp导出,所以问问
'http'=>array(
'header'=>"Connection: keep-alive\r\n"
."Accept-Encoding:gzip, deflate\r\n"
."Pragma:no-cache\r\n"
."Cache-Control:no-cache"
)
);
$result = file_get_contents('http://www.people.com.cn/GB/historic/0826/',false,stream_context_create($header));
$result = iconv('gb2312','utf-8//ignore',gzinflate(substr($result,10)));
preg_match_all('#<a\s+[^>]*class="anavy"[^>]*>((?:(?!</a>).)*)</a>#is',$result,$m);
echo "<pre/>";
print_r(array_map('htmlspecialchars',$m[0]));
print_r($m[1]);