cookie php在一个cookie中存储多个值得代码演示
php在一个cookie中存储多个值得代码演示 [代码片段(22行)]
<?php $info = array("xyz", "yellow", 22); setcookie("usr", serialize($info)); ?> <html><head><title>Multiple Cookie Values</title></head> <h2>$_COOKIE[]</h2> <b> <?php if(! empty($_COOKIE['usr'])){ $cookie_data= $_COOKIE['usr']; $cookie_data=stripslashes($cookie_data); $cookie_data=unserialize("$cookie_data"); echo "What's in the cookie array< br />"; print_r($_COOKIE); echo "<pre>Unserialized data< br />"; print_r( $cookie_data); } ?> </b> </font> </body>
精彩图集
精彩文章