php 正则无效?

浏览:673 发布日期:2013/07/13 分类:求助交流 关键字: php 正则
想写个采集,可是刚开始就遇到问题了,就是貌似正则无法匹配,这是怎么回事呢?求解?我上午用的appserv以为是服务器环境问题,后来下载了个xmapp1.8.2,还是空白一片,测试file_get_content能获取到内容啊,也有<title></title>啊,但是就是匹配不到,郁闷。。。。<?php
class TestAction extends Action {
    public function index() {
        $str = file_get_contents('http://www.gushiwen.org/gushi/tangshi.aspx');
        preg_match("/<title>(.*)</title>/i", $str, $arr);
        echo $arr[1];
     }
最佳答案
评论( 相关
后面还有条评论,点击查看>>