21,893
社区成员




<?php
$url = 'http://www.qq.com/';
$info=file_get_contents($url);
preg_match('| <div id="nav" class="nav">(.*?)</div>|i',$info,$m);
echo substr_replace('<a href="*">', '<li><a target="_blank" href="http://www.qq.com/文字">', 1);
echo $m[1];
?>
$url = 'http://www.qq.com/';
$info = file_get_contents($url);
$pattern = '/<a (.*?)href(\s*)=(\s*)[\'|"](.*?)[\'|"](.*?)>/';
$replacement = '<a ${1}href="http://www.111111.com"${5}>';
var_dump(preg_replace($pattern, $replacement, $info));
<?php
$url = 'http://www.qq.com/';
$info=file_get_contents($url);
echo str_replace('<a href="www.222.cc/234234.html"> 厉害</a>','<a href="www.123.com/tag?=你很厉害>你狠厉害</a>',$info);
?>