PHP file_get_contents does not work on localhost

前端 未结 7 1230
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 21:48

I am working on my website from localhost (http://172.16.65.1/) a MAMP server on OSX.
I want to load some JSON from Google and some simple tests show me I have a probl

7条回答
  •  佛祖请我去吃肉
    2020-12-01 22:32

    This may be a setting in your php.ini file. There is a setting for allow_url_fopen which enables/disables the ability to open remote files from php. For security reasons this is usually defaulted to disabled. You can enable it in your php.ini by adding the following line:

    allow_url_fopen = 1
    

    Again, be aware of the security concerns when using this feature.

    http://php.net/manual/en/filesystem.configuration.php

提交回复
热议问题