这只是一个普通的PHP问题.<?php CODE ?>在我的脚本中有多个有帮助或有害吗?
我只是看了一些我的脚本并注意到其中一些有3-4个.不知道这是否导致我的网站上的任何缓慢或不:)
我有以下数组
"forecast":{
"txt_forecast": {
"date":"11:00 PM EDT",
"forecastday": [
{
"period":0,
"icon":"partlycloudy",
"icon_url":"http://icons-ak.wxug.com/i/c/k/partlycloudy.gif",
"title":"Saturday",
"fcttext":"Partly cloudy in the morning, then mostly cloudy. High of 88F. Winds from the South at 5 to 10 mph.",
"fcttext_metric":"Partly cloudy in the morning, then mostly cloudy. High of 31C. Winds from the South at 10 to 15 km/h.",
"pop":"0"
}
,
{
"period":1,
"icon":"partlycloudy",
"icon_url":"http://icons-ak.wxug.com/i/c/k/partlycloudy.gif",
"title":"Saturday Night",
"fcttext":"Overcast in the evening, then partly cloudy. Low of 64F. Winds less than 5 mph.",
"fcttext_metric":"Overcast in …Run Code Online (Sandbox Code Playgroud) 尝试使用cURL将图像保存到我的服务器.图像似乎下载.它显示正确的字节,但当我链接图像不起作用.我然后DL看到并且没有它的空白图像.
这是我的代码...问题是什么?
$ch = curl_init("'. $image .'");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata=curl_exec ($ch);
curl_close ($ch);
$fp = fopen("$rename.jpg",'w');
fwrite($fp, $rawdata);
fclose($fp);
Run Code Online (Sandbox Code Playgroud)