时间:2021-07-01 10:21:17 帮助过:84人阅读
",$fcontent,$we);$we[1] = str_replace("src=\"http://localhost/m2/i/icon_weather/29x20/", "src=\"http://www.weather.com.cn/m2/i/icon_weather/29x20/", $we[1]);echo $we[1];?>
取得的内容中,图片的连接是
src="/m2/i/icon_weather/29x20/"
src="http://localhost/m2/i/icon_weather/29x20/"
所以你的替换并没有成功
如果只是直接显示,那么可以配上来源在输出
echo str_replace('', '', $fcontent);
echo str_replace('', '', $fcontent);
取得的内容中,图片的连接是
src="/m2/i/icon_weather/29x20/"
src="http://localhost/m2/i/icon_weather/29x20/"
所以你的替换并没有成功
如果只是直接显示,那么可以配上来源在输出
echo str_replace('', '', $fcontent);
echo str_replace('', '', $fcontent);
header("content-Type: text/html; charset=Utf-8");
$url = "http://www.weather.com.cn/weather/101251401.shtml";
$fp = @fopen($url, "r") or die("连接超时");
$fcontent = file_get_contents($url);
echo str_replace('
header("content-Type: text/html; charset=Utf-8");
$url = "http://www.weather.com.cn/weather/101251401.shtml";
$fp = @fopen($url, "r") or die("连接超时");
$fcontent = file_get_contents($url);
echo str_replace('