PHP session 的有效范围设置成整个站点目录
程序员文章站
2024-01-25 14:40:16
...
demo.php
<?php header('Content-Type: text/html; charset=utf-8'); @session_set_cookie_params(3600, "/", "onestopweb.iteye.com", false, TRUE); //启动新会话或者重用现有会话 session_start(); //配置 Seeeion $_SESSION['data'] = array('user'=>'chaoyi','website'=>'onestopweb.iteye.com'); //使用 Session var_dump($_SESSION['data']); echo '<br>SESSION ID:'.session_id(); //session_destroy();
aaa/demo.php
<?php header('Content-Type: text/html; charset=utf-8'); @session_set_cookie_params(3600, "/", "onestopweb.iteye.com", false, TRUE); //启动新会话或者重用现有会话 session_start(); //使用 Session var_dump($_SESSION['data']); echo '<br>SESSION ID:'.session_id();
效果图:
上一篇: DataGuard-创建物理备库全程解析
下一篇: PHP怎么做联系表单?