Full URL not working with php include

前端 未结 6 2000
闹比i
闹比i 2020-12-07 03:55

So, I am trying to insert a file with a php include, but for some reason it doesn\'t work with the full URL.

This works:

6条回答
  •  孤城傲影
    2020-12-07 04:36

    include is meant to include and evaluate a specified PHP file. If you fetch it locally, it can be processed like PHP - if you fetch it through a full URL, you will get the resulting HTML (in theory ... you may get only an error).

    Supporting Docs

    include 'menu.php' //Internally process a PHP file to generate HTML
    

    or

    file_get_contents('http://domainname.com/menu.php'); //Fetch resutling HTML
    

提交回复
热议问题