数组中的cookie名称

时间:2015-04-27 10:49:53

标签: php cookies

<?php
//set cookie for testing//

//create var 
$cookie_name1 = 'dee[user]'; //this one cant use 
$cookie_name2 = 'dee'; // but this one can
$age = 'dee15';

setcookie($cookie_name,$age, time()+(60*60*30),'','','',TRUE);    

if(!isset($_COOKIE[$cookie_name])){
    print 'Cookie with name "' . $cookie_name . '" does not exist...';
}else{
    print 'Cookie with name "' . $cookie_name . '" value is: ' . $_COOKIE[$cookie_name];
}
?>

如果我将cookie设置为dee[user]它会返回错误有什么问题?

如果我设置dee它返回true,我真的需要把数组放进去吗?我有没有做错了?

0 个答案:

没有答案