PHP - include() file not working when variables are put in url?

后端 未结 5 1687
梦毁少年i
梦毁少年i 2021-01-13 18:28

In PHP I\'ve build a webpage that uses include() for loading parts of the website. However, I now ran into something like a problem: When I use an url like: data-openo

5条回答
  •  醉酒成梦
    2021-01-13 19:16

    Unless you've got a fully qualified URL, with protocol:// in the address, PHP will interpret what you pass into include()/require() as a LOCAL file, which means it's looking for a file on your drive whose name real is data-storingen.php?type=actueel, whereas you've only got data-storingen.php.

    Since you're dealing with a local file, there is no support for query strings, and you have to strip that out of the "filename" you're passing to include().

提交回复
热议问题