包括PHP中的远程文件 [英] including a remote file in PHP
问题描述
我无法在PHP脚本中包含远程PHP文件。我想我的托管改变了php设置。
I am unable to include a remote PHP file in my PHP script. I suppose my hosting changed php settings.
我使用的代码是:
include "http://domain.com/folder/file.php";
如何使用php.ini / .htaccess启用include函数?
How do I allow enable the include function using php.ini/.htaccess ?
还有其他解决方法吗?
谢谢。
推荐答案
要允许包含远程文件,指令 allow_url_include
必须在php中设置为 On
。 ini
To allow inclusion of remote files, the directive allow_url_include
must be set to On
in php.ini
但从安全导向的观点来看,这是不好的;因此,它通常是禁用的(实际上我从来没有看到它启用)
But it is bad, in a security-oriented point of view ; and, so, it is generally disabled (I've never seen it enabled, actually)
它与 allow_url_fopen
,这笔交易打开(不包括)远程文件 - 这个通常是启用的,因为它使得通过HTTP获取数据变得更容易(比使用curl更容易)
It is not the same as allow_url_fopen
, which deals with opening (and not including) remote files -- and this one is generally enabled, because it makes fetching of data through HTTP much easier (easier than using curl)
这篇关于包括PHP中的远程文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!