gpt4 book ai didi

php - allow_url_fopen 已打开,仍然无法获取数据

转载 作者:可可西里 更新时间:2023-11-01 01:03:09 25 4
gpt4 key购买 nike

打开访问权限还是php报错怎么办?

Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in ------------- on line 40

Warning: file_get_contents(http://finance.google.co.uk/finance/info?client=ig&q=NASDAQ:MSFT) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in --------------- on line 40

enter image description here

最佳答案

尝试

ini_set("allow_url_fopen", 1);
if (ini_get("allow_url_fopen") == 1) {
echo "allow_url_fopen is ON";
} else {
echo "allow_url_fopen is OFF";
}
print ini_get("allow_url_fopen");

或者你可以试试别的方法

function curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$return = curl_exec($ch);
curl_close ($ch);
return $return;
}
$string = curl('http://www.example.org/myfile.php');

尝试将此代码添加到您的 .htaccess 文件中:

php_value allow_url_fopen On

如果使用 wamp php.ini 是两个文件夹 C:\wamp\bin\apache\apacheVersion\binC :\wamp\bin\php\phpVersion 所以在两个文件中设置 allow_url_fopen=on

关于php - allow_url_fopen 已打开,仍然无法获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17927574/

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