<?php
$title='dwww';
$hello='dwwwcn!';
$file=file_get_contents('http://www.baidu.com');
$file=iconv("gbk//IGNORE","utf-8",$file);
//echo $file;
echo strpos($file,'<title>');
echo substr($file,strpos($file,'<title>')+7,strpos($file,'</title>'-strpos($file,'<title>')+7));
$file=str_replace(array('百度一下','{hello}'),array($title,$hello), $file);
?>
本文介绍了一个简单的PHP脚本,该脚本使用file_get_contents获取网页内容,并通过iconv进行编码转换。接着,脚本利用字符串操作函数实现了对特定HTML元素的定位及内容替换。
661

被折叠的 条评论
为什么被折叠?



