更新时间:2023-02-05 08:53:21
不,此设置在大多数 Web 服务器 (php.ini) 中默认禁用/不允许,因此您不能使用 include
出于安全原因,包含来自远程地址的文件.
Nope, this setting is disabled/not allowed by default in most web servers (php.ini) so you can not use the include
to include the files from a remote addresss for security reasons.
如果您仍想允许包含远程文件,指令 allow_url_include
必须在 php.ini 中设置为 On
If you still want to allow inclusion of remote files, the directive allow_url_include
must be set to On
in php.ini
但从面向安全的角度来看,这又是一种不好的做法;因此,它通常被禁用(实际上我从未见过它启用)
But again it is a bad practice, in a security-oriented point of view ; and, so, it is generally disabled (I've never seen it enabled, actually)
如果你想读取远程文件的内容,你可以使用file_get_contents
函数代替 BUT 这将作为纯 HTML 标记代码返回,有不会是任何服务器端代码.
If you want to read the contents of a remote file though, you can use the file_get_contents
function instead BUT this will be returned as pure HTML markup code, there won't be any server-side code.