including a remote file in PHP(在 PHP 中包含一个远程文件)
问题描述
我无法在我的 PHP 脚本中包含远程 PHP 文件.我想我的主机更改了 php 设置.
我使用的代码是:
包括http://domain.com/folder/file.php";
如何允许使用 php.ini/.htaccess 启用包含功能?
还有其他解决方法吗?
谢谢.
为了允许包含远程文件,指令 allow_url_include
必须在 php.ini 中设置为 On
p>
但从面向安全的角度来看,这很糟糕;因此,它通常被禁用(实际上我从未见过它启用)
和 allow_url_fopen
,它处理打开(不包括)远程文件——这个通常是启用的,因为它使通过 HTTP 获取数据更容易(比使用 curl 更容易)
I am unable to include a remote PHP file in my PHP script. I suppose my hosting changed php settings.
The code I was using was:
include "http://domain.com/folder/file.php";
How do I allow enable the include function using php.ini/.htaccess ?
Is there any other workaround?
Thanks.
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)
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 中包含一个远程文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 PHP 中包含一个远程文件


基础教程推荐
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- php中的PDF导出 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- 将变量从树枝传递给 js 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的foreach复选框POST 2021-01-01