简体   繁体   中英

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

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

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.

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. This is NOT the right way because this way you are going to get some HTML from the webserver. 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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