gpt4 book ai didi

php - 我怎样才能从父页面传递一个php变量来包含页面

转载 作者:可可西里 更新时间:2023-10-31 22:53:10 24 4
gpt4 key购买 nike

我在我的父页面中包含一个页面 childpage.php,我想从父页面传递一个变量到 childpage.php 我也想访问这个我的 childpage.php 中的变量。这是我的代码:

include_once("childpage.php?a='$x'");

为什么这行不通?

最佳答案

你可以在include so之前定义变量

$x = 'something that is needed in the include file';
include_once("childpage.php");

您现在可以在 childpage.php 中使用 $x 变量。

关于php - 我怎样才能从父页面传递一个php变量来包含页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32198917/

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