当变量放在url中时,include()文件不工作? [英] PHP - include() file not working when variables are put in url?
问题描述
在PHP中,我构建了一个使用include()加载网站部分的网页。
然而,我现在遇到了一个类似问题的东西:
当我使用如下的url: data-openov-storingen.php?type = actueel
它给了我这个错误:
警告:include(data-storingen.php?type = actueel):失败打开流:blablabla中没有这样的文件或目录
是否有可能通过get变量在 include()
url?
include()
函数不通过HTTP访问文件,它通过操作系统自己的文件系统访问文件。所以GET变量不计算在内。 (因为它们不是文件名的一部分)。
通俗地说,包含的要点是将文件中的所有内容复制/粘贴到文件中的另一个文件上,以便您没有巨大的文件,但一些小,更可维护的文件。
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-openov-storingen.php?type=actueel
It gives me this error:
Warning: include(data-storingen.php?type=actueel): failed to open stream: No such file or directory in blablabla
Is it even possible to pass get variables in an include()
url?
The include()
function does not access the file via HTTP, it accesses the file through the OS's own file system. So GET variables are not counted. (as they are not part of the file name).
In layman's terms, the point of include is to "copy/paste" all the contents on one file to another on the file, so that you don't have one gigantic file, but a few smaller, more maintainable ones.
这篇关于当变量放在url中时,include()文件不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!