PHP - 将变量放入 url 时,include() 文件不起作用? [英] PHP - include() file not working when variables are put in url?

查看:20
本文介绍了PHP - 将变量放入 url 时,include() 文件不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 PHP 中,我构建了一个使用 include() 加载网站部分的网页.但是,我现在遇到了类似的问题:当我使用如下网址时:data-openov-storingen.php?type=actueel它给了我这个错误:

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

是否可以在 include() url 中传递 get 变量?

Is it even possible to pass get variables in an include() url?

推荐答案

include() 函数不通过 HTTP 访问文件,它通过操作系统自己的文件系统访问文件.所以 GET 变量不计算在内.(因为它们不是文件名的一部分).

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).

通俗地说,include 的目的是将一个文件上的所有内容复制/粘贴"到另一个文件上,这样您就不会拥有一个巨大的文件,而是一些更小、更易于维护的文件.

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.

这篇关于PHP - 将变量放入 url 时,include() 文件不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆