大佬教程收集整理的这篇文章主要介绍了PHP变量作为URL中的参数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$ip=$_SERVER[\'REMOTE_ADDR\']; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,\"http://free.worlDWeatheronline.com/Feed/weather.ashx?key=xxxxxxxxxxxxxxx&q=.$ip.&localObsTime&num_of_days=5&format=Json\"); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_header,0); $outputJson = curl_exec($ch); if ($outputJson === falSE) { echo \'Error: \'.curl_error($ch); } echo \'<pre> \'; print_r($outputJson); echo \'</pre> \';@H_874_5@
$ip@H_874_5@之前和之后有一些不必要的点: 使用以下任何一项: @H_674_2@
\"http://...$ip...\" \"http://...{$ip}...\" \"http://...\" . $ip . \"...\";@H_874_5@ , 尝试做 @H_674_2@
curl_setopt($ch,CURLOPT_URL,\"http://free.worldweatheronline.com/feed/weather.ashx?key=xxxxxxxxxxxxxxx&q=\".$ip.\"&localObsTime&num_of_days=5&format=json\");@H_874_5@ , 您不需要连接字符串,因为您使用的是双引号。所以你要么做: @H_674_2@
curl_setopt($ch,\"http://free.worldweatheronline.com/feed/weather.ashx?key=xxxxxxxxxxxxxxx&q=$ip&localObsTime&num_of_days=5&format=json\");@H_874_5@ 在网址中。 , 您正在字符串中使用字符串连接运算符。要么使用 @H_674_2@
\"http://free.worldweatheronline.com/feed/weather.ashx?key=xxxxxxxxxxxxxxx&q=$ip&localObsTime&num_of_days=5&format=json\"@H_874_5@ 要么 @H_674_2@
\'http://free.worldweatheronline.com/feed/weather.ashx?key=xxxxxxxxxxxxxxx&q=\'.$ip.\'&localObsTime&num_of_days=5&format=json\'@H_874_5@
以上是大佬教程为你收集整理的PHP变量作为URL中的参数全部内容,希望文章能够帮你解决PHP变量作为URL中的参数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。