了解到gwan应支持全局变量$_GET、$_POST和$_COOKIE,但$_COOKIE不起作用?
怎么可能读懂它们?
感谢
试试这个:
设置Cookie
<?php
setcookie(“user”,”Angga”);
setcookie(“user", “nic", time()+3600);
setcookie(“user", “nic", time()+3600, "/","", 0);
?>
读取Cookie
<?php
//Display the value of ‘user’
echo $_COOKIE[“user"]. "<br />";
//This is another way
echo $HTTP_COOKIE_VARS[“user"]. "<br />";
?>
检查Cookie的状态
<?php
// Using isset() function
if( isset($_COOKIE[“user"]))
echo “Hello " . $_COOKIE[“user"] . "<br />";
else
echo “Nothing" . "<br />";
?>
删除Cookie
<?php
setcookie( “user", "", time()- 3600, "/","", 0);
?>
更新#1
或者试着读一下:
GWAN:如何读取cookie
由于G-WAN通过CGI支持PHP,因此可以使用CGI环境X_HTTP_HEADERS
读取整个标头。