4.layhm框架初始化准备Init
hm\core\Boot 里
Boot 里run() 自动开起session 设置时区
<?php
/**
* Created by Haima.
* Author:Haima
* QQ:228654416
* Date: 2018/9/12
* Time: 5:39
*/
namespace hm\core;
class Boot
{
public static function run()
{
self::init();
echo date('Y-m-d H:i:s');
//定义session
$_SESSION['haima'] = [
'name'=>'haima',
'age'=>30
];
p($_SESSION); //获取session
// unset($_SESSION['haima']); //消除session
//session_destroy(); //彻底终结 session,这时所有的session数据都会消失
//p($_SESSION);
}
public static function init()
{
session_id() || session_start(); //如果没有session_id就开起session
date_default_timezone_set('PRC');//设置时区
}
}
public/index.php里
<?php
include '../vendor/autoload.php';
\hm\core\Boot::run(); //加载Boot里的run();
?>
[Haima的博客]
http://www.cnblogs.com/haima/