首页 >php教程 >PHP源码 >PHP 通过 Cookie 记录用户的访问时间

PHP 通过 Cookie 记录用户的访问时间

PHP中文网
PHP中文网原创
2016-05-25 17:16:011387浏览

php代码:

<?php
 setcookie( "vegetable", "artichoke", time()+3600, "/",".oschina.net", 0 );
 ?>
 <html>
 <head>
 <title>Setting and Printing a Cookie Value</title>
 </head>
 <body>
 <?php
 if ( isset( $_COOKIE[&#39;vegetable&#39;] ) ) {
     print "<p>Hello again, your chosen vegetable is ";
     print "{$_COOKIE[&#39;vegetable&#39;]}</p>";
 } else {
     print "<p>Hello you. This may be your first visit</p>";
 }
 ?>
 </body>
 </html>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn