为什么我的PHP包含功能无法正常工作?

Jac*_*lly 1 html php forms

我有这个PHP代码 -

<?php include('res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month'); ?>
Run Code Online (Sandbox Code Playgroud)

正如你可以看到我,包括?type&query它,所以它是错误的或者有别的东西哪去错了.因为它向我显示以下错误---

Warning: include(res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month) [function.include]: failed to open stream: No error in C:\xampp\htdocs\mysharepoint\1.1\res\scripts\php\content_type\register_form.php on line 82

Warning: include() [function.include]: Failed opening 'res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month' for inclusion (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\mysharepoint\1.1\res\scripts\php\content_type\register_form.php on line 82
Run Code Online (Sandbox Code Playgroud)

但删除后?type=register&query=birth_month,我没有错!那么你对此有什么建议,请告诉我.

提前致谢!

Bil*_*oon 7

您试图将其包含为通过Web提供,但include只会加载本地文件 - 因此没有查询字符串,因为没有进行处理


此外 - 如果您尝试从脚本输出外部URL,您可以执行以下操作:

echo implode(file('http://localhost/res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month'))
Run Code Online (Sandbox Code Playgroud)