在 PHP 中是否有可能在以前存储字符串的地方有一个数组?
echo "valuebefore: ".$_SESSION['REQUEST_TOKEN'][TL_MODE];
$_SESSION['REQUEST_TOKEN'][TL_MODE] = "somestring";
echo "typebefore: ".gettype($_SESSION['REQUEST_TOKEN'][TL_MODE]);
$_SESSION['REQUEST_TOKEN'][TL_MODE] = array();
echo "typeafter: ".gettype($_SESSION['REQUEST_TOKEN'][TL_MODE]);
if (!is_array($_SESSION['REQUEST_TOKEN'][TL_MODE]))
{
echo "is not an array";
}
echo "valueafter: ".$_SESSION['REQUEST_TOKEN'][TL_MODE];
输出是:
valuebefore: A
typebefore: string
typeafter: string << the type didnt change to array!
is not an array
valueafter: A << the value was not updated!
为什么它不能只保存新数组?为什么价值也没有改变?
编辑:
这是涉及的其他变量的 vardump:
echo var_dump(TL_MODE)." <br/>";
echo var_dump($_SESSION['REQUEST_TOKEN'])." <br/>";
echo var_dump($_SESSION['REQUEST_TOKEN'][TL_MODE])." <br/>";
输出:
string(2) "FE"
string(32) "A96665c9f1e41d1745bf3a3d75cff33a"
string(1) "A"