[英]Passing variable from one php file to another
所以在我的PHP腳本完成后,我有這行:
$success = TRUE;
header('Location: ../admin.php'); //the main file
在admin.php文件中,有以下一行:
<?php
if ($_GET["success"] == TRUE) {
echo "<b>Your file has been imported.</b><br><br>";
}
知道為什么不傳遞此布爾值以及為什么回聲不起作用嗎?
您需要像這樣在網址中傳遞變量:
header("Location: ../admin.php?success=$success");
//^ ^^^^^^^^^^^^^^^^^
這樣,您就可以在下一頁通過$_GET
進行訪問。 還要注意,我在這里使用了雙引號,以便將字符串中的變量解析為變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.