小编PVJ*_*AZZ的帖子

为什么file_get_contents不起作用?

为什么file_get_contents 不为我工作?在下面的测试文件代码中,似乎我搜索过的所有人的示例都列出了此函数,但它永远不会被执行.这是网络托管服务的问题吗?有人可以在他们的服务器上测试这段代码只是为了看看地理编码数组输出是否实际打印成字符串?当然,我正在尝试将输出分配给变量,但此测试文件中没有输出....

<html>
<head>        
<title>Test File</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> 
</script>
</head>
<body>
<?    
$adr = 'Sydney+NSW';
echo $adr;
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$adr&sensor=false";
echo '<p>'.$url.'</p>';
echo file_get_contents($url);
print '<p>'.file_get_contents($url).'</p>';
$jsonData   = file_get_contents($url);
echo $jsonData;
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

php geocoding file-get-contents

11
推荐指数
2
解决办法
10万
查看次数

标签 统计

file-get-contents ×1

geocoding ×1

php ×1