Home  >  Article  >  php教程  >  演示session

演示session

PHP中文网
PHP中文网Original
2016-05-26 08:18:501089browse

演示session

<?php
session_start();
$_SESSION[&#39;name&#39;]="星星";
$_SESSION[&#39;age&#39;]=23;
print_r($_SESSION);
echo &#39;<br/>这是session.php&#39;;
/*
 * 注销session的方法:
//清空所有的session内容
$_SESSION=array();
//删除单个元素
unset($_SESSION[&#39;name&#39;]);
//结束会话
session_destroy();
*/
?>
<?php
/*
 * 跨页面传递
 * */
session_start();
print_r($_SESSION); //输出session中设置的值
echo &#39;<br/>这是testsession.php&#39;;


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn