gpt4 book ai didi

php - 在 PHP :how can I use include() Function which parameter is variable?

转载 作者:行者123 更新时间:2023-12-04 01:02:37 25 4
gpt4 key购买 nike

我需要使用带变量的 include 函数。

但是,当我尝试这样做时,我遇到了一些错误。

代码:

$year=$_POST['year'];

$month=$_POST['month'];

$day=$_POST['day'];

include "Event.php?year=".$year."&month=".$month."&day=".$day;

那么,你能帮我吗? :)

最佳答案

当您包含文件时,您不能向它们传递任何参数。然而,它们确实继承了当前范围内的任何变量(全局或方法)。

我在猜测你的代码做了什么,但我假设你可以这样做:

包含“Event.php”;

关于php - 在 PHP :how can I use include() Function which parameter is variable?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2877851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com