包括PHP中的远程文件 [英] including a remote file in PHP

查看:83
本文介绍了包括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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆