【发布时间】:2016-10-11 15:44:07
【问题描述】:
我不想允许从其他页面获取 cookie !我已经在互联网上搜索过,但没有真正找到,或者我可能不知道如何提及那个案例。我该如何处理!我想在test2.php 中获取空值,但在test.php 中获取cookie?
test.php
<?php
setcookie("acc_id", "23A", time() + 3600, '/');
header("test.php");
var_dump($_COOKIE); // 'acc_id' => string '23A' (length=3)
?>
test2.php
<?php
var_dump($_COOKIE); // 'acc_id' => string '23A' (length=3)
【问题讨论】:
-
...那么不要在
test2.php中调用$_COOKIE吗?为什么你不希望它跨越?这正在扼杀_COOKIE的设计目的。