简体   繁体   English

包括使用 PHP 的链接

[英]Include a link using PHP

Today I'm trying to include a page in another one in PHP using the link instead of the path, so the code could look like this今天我尝试使用链接而不是路径在 PHP 中的另一个页面中包含一个页面,因此代码可能如下所示

include "http://localhost/mypage/myfile.php"

but it throws me the following error:但它抛出了以下错误:

Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\xampp\htdocs\Lavoro\lang\en\login\home.php on line 10警告:include(): http:// 包装器在服务器配置中被C:\xampp\htdocs\Lavoro\lang\en\login\home.ZE1BFD762328E4963 行上的allow_url_include=0 禁用

I really don't know how to change these variable.我真的不知道如何更改这些变量。 I've tried using some line of code that I found also in this forum but nothing works, And another thing.我尝试使用我也在这个论坛中找到的一些代码行,但没有任何效果,还有另一件事。 I don't know which version of PHP I'm using.我不知道我使用的是哪个版本的 PHP。

Thanks for everyone who wants to help me感谢所有想帮助我的人

The warning is generated because you are using a full URL for the file that you are including.生成警告是因为您对包含的文件使用了完整的URL This is NOT the right way because this way you are going to get some HTML from the webserver.这不是正确的方法,因为这样您将从网络服务器获得一些HTML Use:利用:

require_once('mypage/myfile.php');  //your file name

so that webserver could EXECUTE the script and deliver its output, instead of just serving up the source code (your current case which leads to the warning).这样网络服务器就可以执行脚本并提供其 output,而不仅仅是提供源代码(您当前的情况会导致警告)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM