正责表达式

WBOY
WBOY원래의
2016-06-13 10:15:43854검색

求助正责表达式

CSS code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $str = getHtml('http://www.youku.com/show_page/id_z70846538ce0311e0a046.html');$str = iconv('utf-8','gbk',$str);preg_match_all('/<div class="pack_thumb">([\s\S]*?)/isU' ,$str , $match);preg_match_all('/href="([\s\S]*?)"/' , $match[1][0], $href );print_r($href);exit();function getHtml($url){        if(function_exists('file_get_contents')){            $file_contents = file_get_contents($url);        }        else{            $ch = curl_init();            $timeout = 5;            curl_setopt ($ch, CURLOPT_URL, $url);            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);            curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);            $file_contents = curl_exec($ch);            curl_close($ch);        }        return $file_contents;    }


我要得到分集连接,
但是结果是 连接多了点,要去掉。主要是匹配范围的时候多了点内容,不知道怎么样去掉。还请知点一下。、


我要得到的效果是:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->            [0] => http://v.youku.com/v_show/id_XMzA0NjA4MjA4.html            [1] => http://v.youku.com/v_show/id_XMzA0NjA4MjA4.html            [2] => http://v.youku.com/v_show/id_XMzA2NTYxNDIw.html            [3] => http://v.youku.com/v_show/id_XMzA2NTYxNDIw.html            [4] => http://v.youku.com/v_show/id_XMzA4NTQ4NjE2.html            [5] => http://v.youku.com/v_show/id_XMzA4NTQ4NjE2.html            [6] => http://v.youku.com/v_show/id_XMzEwNTQyNDM2.html            [7] => http://v.youku.com/v_show/id_XMzEwNTQyNDM2.html            [8] => http://v.youku.com/v_show/id_XMzEyNjE3OTAw.html            [9] => http://v.youku.com/v_show/id_XMzEyNjE3OTAw.html            [10] => http://v.youku.com/v_show/id_XMzE0NzM4Mjky.html            [11] => http://v.youku.com/v_show/id_XMzE0NzM4Mjky.html            [12] => http://v.youku.com/v_show/id_XMzE2OTU0NTgw.html            [13] => http://v.youku.com/v_show/id_XMzE2OTU0NTgw.html            [14] => http://v.youku.com/v_show/id_XMzE5MjcyMTY4.html            [15] => http://v.youku.com/v_show/id_XMzE5MjcyMTY4.html            [16] => http://v.youku.com/v_show/id_XMzIxNDk2NDcy.html            [17] => http://v.youku.com/v_show/id_XMzIxNDk2NDcy.html            [18] => http://v.youku.com/v_show/id_XMzQwMjAxNzgw.html            [19] => http://v.youku.com/v_show/id_XMzQwMjAxNzgw.html            [20] => http://v.youku.com/v_show/id_XMzQyNTE2OTA4.html            [21] => http://v.youku.com/v_show/id_XMzQyNTE2OTA4.html            [22] => http://v.youku.com/v_show/id_XMzQ0Njk1NDk2.html            [23] => http://v.youku.com/v_show/id_XMzQ0Njk1NDk2.html            [24] => http://v.youku.com/v_show/id_XMzQ4NDIyMTI0.html            [25] => http://v.youku.com/v_show/id_XMzQ4NDIyMTI0.html            [26] => http://v.youku.com/v_show/id_XMzUxMDI3ODg0.html            [27] => http://v.youku.com/v_show/id_XMzUxMDI3ODg0.html            [28] => http://v.youku.com/v_show/id_XMzUzMzUzMjc2.html            [29] => http://v.youku.com/v_show/id_XMzUzMzUzMjc2.html            [30] => http://v.youku.com/v_show/id_XMzY2NTk3MTU2.html            [31] => http://v.youku.com/v_show/id_XMzY2NTk3MTU2.html            [32] => http://v.youku.com/v_show/id_XMzY5OTM1MzAw.html            [33] => http://v.youku.com/v_show/id_XMzY5OTM1MzAw.html            [34] => http://v.youku.com/v_show/id_XMzczNTE4NTA4.html            [35] => http://v.youku.com/v_show/id_XMzczNTE4NTA4.html            [36] => http://v.youku.com/v_show/id_XMzAwMDk4NDM2.html            [37] => http://v.youku.com/v_show/id_XMzAwMDk4NDM2.html            [38] => http://v.youku.com/v_show/id_XMzA0MTE1MzQw.html            [39] => http://v.youku.com/v_show/id_XMzA0MTE1MzQw.html            [40] => http://v.youku.com/v_show/id_XMjcwMDMwMDc2.html            [41] => http://v.youku.com/v_show/id_XMjcwMDMwMDc2.html            [42] => http://v.youku.com/v_show/id_XMzA0Njg4MDIw.html            [43] => http://v.youku.com/v_show/id_XMzA0Njg4MDIw.html<div class="clear">
                 
              
              
        
            </div>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.