$e=clinchgeturl(http://pic3.phprm.com/2013/05/18/forumdisplay.jpg); var_dump($e); function clinchgeturl($url) { //$url="http://127.0.0.1/1.htm"; //$rootpath="http://fsrootpathfsfsf/yyyyyy/"; //var_dump($rrr); if(eregi('(.)*[.](.)*',$url)){ $roopath=split("/",$url); $rootpath="http://".$roopath[2]."/"; $nnn=count($roopath)-1;for($yu=3;$yu // var_dump($rootpath); //http: ,'',127.0.0.1,xnml,index.php } else{$rootpath=$url;//var_dump($rootpath); } if(isset($url)){ echo "$url 有下列裢接: "; $fcontents = file($url); while(list(,$line)=each($fcontents)){ while(eregi('(href[[:space:]]*=[[:space:]]*"?[[:alnum:]:@/._-] [?]?[^"]*"?)',$line,$regs)){ //$regs[1] = eregi_replace('(href[[:space:]]*=[[:space:]]*"?)([[:alnum:]:@/._-] )("?)',"2",$regs[1]); $regs[1] = eregi_replace('(href[[:space:]]*=[[:space:]]*["]?)([[:alnum:]:@/._-] [?]?[^"]*)(.*)[^"/]*(["]?)',"2",$regs[1]); if(!eregi('^http://',$regs[1])){ if(eregi('^..',$regs[1])){ // $roopath=eregi_replace('(http://)?([[:alnum:]:@/._-] )[[:alnum:] ](.*)[[:alnum:] ]',"http://2",$url); $roopath=split("/",$rootpath); $rootpath="http://".$roopath[2]."/"; //echo "这是根本d :"."n"; $nnn=count($roopath)-1;for($yu=3;$yu //var_dump($rootpath); if(eregi('^..[/[:alnum:]]',$regs[1])){ //echo "这是../目录/ :"."n"; //$regs[1]="../xx/xxxxxx.xx"; // $rr=split("/",$regs[1]); //for($oooi=1;$oooi $rrr=$regs[1]; // {$rrr.="/".$rr[$oooi]; $rrr = eregi_replace("^[.][.][/]",'',$rrr); /
|