PHP - 将变量放入 url 时,include() 文件不起作用?

PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)
本文介绍了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() 文件不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)