gpt4 book ai didi

php - 警告 : file_get_contents(): https://wrapper is disabled in the server configuration by all

转载 作者:IT王子 更新时间:2023-10-29 00:06:18 26 4
gpt4 key购买 nike

当我上传带有邮政编码的 csv 文件时,它会转换并保存纬度和经度。发生的错误是将邮政编码转换为经纬度。在我的本地主机上它工作正常。当我在实时服务器上载时。我收到此错误 Warning: file_get_contents(): https://wrapper is disabled in the server configuration by allow_url_fopen=0 in/hermes/bosnaweb05a/b1410/ipg.rwdinfotechcom/vw/zipmapping/index.php online 29 。我也检查了我的谷歌 api key 。我无法添加 php.ini 文件。如果我上传 php.ini 文件,它会显示内部服务器错误。

Here my code
function getLnt($zip){
$url = "https://maps.googleapis.com/maps/api/geocode/json?key=AIzaSyDEGgYDar8y3Bx-1FpY3hq6ON4LufoRK60&address=
".urlencode($zip)."&sensor=false";

$result_string = file_get_contents($url);
$result = json_decode($result_string, true);

$result1[]=$result['results'][0];
$result2[]=$result1[0]['geometry'];
$result3[]=$result2[0]['location'];
return $result3[0];
}

最佳答案

首先,用这段代码检查你的 PHP 文件,然后在你的 php.ini 文件中启用 fopen

<?php 
if( ini_get('allow_url_fopen') ) {
die('allow_url_fopen is enabled. file_get_contents should work well');
} else {
die('allow_url_fopen is disabled. file_get_contents would not work');
}

?>

编辑 php.ini 文件并使用以下代码启用

allow_url_fopen = 1 //0 for Off and 1 for On Flag

关于php - 警告 : file_get_contents(): https://wrapper is disabled in the server configuration by all,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36952204/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com