小编Kam*_*leh的帖子

file_get_contents()不起作用

我有一个脚本用于file_get_contents()从远程服务器获取json响应.虽然file_get_contents()在本地文件上正常工作,但没有使用http或https它给我以下错误file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 infile_get_contents(https://api.domain.com/resolve.json?url=blablabla): failed to open stream: no suitable wrapper could be found..它是一个专用的服务器,我有WHM ..我试过

  1. allow_url_fopen = on在WHM PHP配置编辑器上设置,但这不起作用.
  2. allow_url_fopen = on在发生错误的目录中创建一个php.ini文件,但这不起作用.
  3. 添加ini_set('allow_url_fopen', 'On');到PHP脚本的开头,但这不起作用.

我知道我可以使用Curl,但我想知道为什么这不起作用..脚本在其他服务器和localhost上正常工作

更新:

phpinfo();
Run Code Online (Sandbox Code Playgroud)

给我

allow_url_fopen Off 
allow_url_include   Off 
always_populate_raw_post_data   Off
Run Code Online (Sandbox Code Playgroud)

这意味着我的php.ini更改没有生效..我做错了什么?

php apache curl

3
推荐指数
3
解决办法
4万
查看次数

标签 统计

apache ×1

curl ×1

php ×1