1.在写入session的页面. use yii\web\Session;$session = new Session;$session->open(); 2.在获取session的页面 use yii\web\Session;$session = new Session;$session->open();…
1.线程容器,给线程绑定一个Object 内容,后只要线程不变,可以随时取出. 1.1 改变线程,无法取出内容. final ThreadLocal threadLocal = new ThreadLocal<>(); threadLocal.set("测试"); new Thread(){ public void run() { String result = threadLocal.get(); System.out.println("结果:"+re…