http://library.cuhk.edu.hk/search~S15/?searchtype=d&searcharg=+life&searchscope=15&SORT=DZ&extended=0&SUBMIT=Search&searchlimits=&searchorigarg=X+life%26SORT%3DDZ
我要取得东西是Life -- 5 Related Subjects    
   Life.    
  Life after death -- 2 Related Subjects    
   Life among the lowly. -- See Uncle Tom's cabin.     
   Life and adventures of Martin Chuzzlewit. -- See Martin Chuzzlewit.     
    Life and adventures of Robinson Crusoe. -- See Robinson Crusoe.    
  Life and death of King John -- See King John      
   Life and death of King Richard the Second. -- See King Richard II.     
    Life and death of the mayor of Casterbridge. -- See Mayor of Casterbridge.     
   Life and death, Power over -- See also the narrower term Right to die    
    Life and death, Power over.     
    Life and death, Power over -- Decision making.  

解决方案 »

  1.   

    Life -- 5 Related Subjects    
      Life.    
      Life after death -- 2 Related Subjects    
      Life among the lowly. -- See Uncle Tom's cabin.    
      Life and adventures of Martin Chuzzlewit. -- See Martin Chuzzlewit.    
        Life and adventures of Robinson Crusoe. -- See Robinson Crusoe.    
      Life and death of King John -- See King John      
      Life and death of King Richard the Second. -- See King Richard II.    
        Life and death of the mayor of Casterbridge. -- See Mayor of Casterbridge.    
      Life and death, Power over -- See also the narrower term Right to die    
        Life and death, Power over.    
        Life and death, Power over -- Decision making.  
    内容一共是12个 我想用正则表达式把它提取出来谢谢了
      

  2.   

    顶贴~!随便做下广告
    PHP MYSQL CMS交流群88286077
      

  3.   


    $str = strip_tags(file_get_contents("http://library.cuhk.edu.hk/search~S15/?searchtype=d&searcharg=+life&searchscope=15&SORT=DZ&extended=0&SUBMIT=Search&searchlimits=&searchorigarg=X+life%26SORT%3DDZ"), "<td>");
    preg_match_all("/<td  class=\"browseEntryData\">([^<>]+)<\/td>/ims", $str, $matches);
    var_dump($matches);
      

  4.   

    <?php$str = file_get_contents('http://library.cuhk.edu.hk/search~S15/?searchtype=d&searcharg=+life&searchscope=15&SORT=DZ&extended=0&SUBMIT=Search&searchlimits=&searchorigarg=X+life%26SORT%3DDZ');
    preg_match_all('#<td\s*class\s*=\s*["\']browseEntryData["\'][^>]*?>(.*?)</td>#is', $str, &$matches);
    var_dump($matches[1]);foreach((array)$matches[1] as $v)
    {
        echo strip_tags($v).'<br />';
    }?>
      

  5.   

    七楼你的正则表达式运行出来是array(0) { } 的呀
      

  6.   

    页面有问题 发表后多加了空格.<?php$str = file_get_contents('http://library.cuhk.edu.hk/search~S15/?searchtype=d&searcharg=+life&searchscope=15&SORT=DZ&extended=0&SUBMIT=Search&searchlimits=&searchorigarg=X+life%26SORT%3DDZ');
    preg_match_all('#<td\s*class\s*=\s*["\']browseEntryData["\'][^>]*?>(.*?)</td>#is', $str, &$matches);
    var_dump($matches[1]);foreach((array)$matches[1] as $v)
    {
        echo strip_tags($v).'<br />';
    }?>