-
public?function?actionIndex()?{ ????$session?=?YII::app->session; ????$session->open();??//開啟session ????if($session->isActive)?{???//判斷session是否開啟 ????????echo?'session?is?active'; ????} ????$session->set('user','張三');//設(shè)置session ????$session['name']=?'張三'; ????echo?$session->get('user');//獲取session ????echo?$session['name']; ????$session->remove('user');//刪除session ????unset($session['name']); }
查看全部 -
public?funciton?actionIndex()? { ????$resquest?=?\YII::$app->request; ????echo?$request->get('id',20);??//如果又傳過來的id值就用傳過來的??沒有就用20 ????echo?$request->post('name',3333); ????if($request->isPost)?{ ????????echo?'this?is?post?method!'; ????} ???? ????echo?$request->userIp; }
查看全部 -
public?function?actionIndex(){ ????$res?=?\YII::$app->response; ????$res->statusCode?=?404;???//修改狀態(tài)碼 ????$res->headers->add('pragma','no-cache');??//沒有緩存 ????$res->headers->set('pragma','max-age=5');?//修改緩存變成5秒 ????$res->headers->remove('pragma');//移出該設(shè)置 ????//跳轉(zhuǎn) ????$res->headers->add('location','http://www.baidu.com'); ????$this->redirect('http;//www.baidu.com',302); ????//文件下載 ????$res->headers->add('content-disposition','attachment;filename="a.jpg"'); ????$res->sendFile('./robots.txt'); ???? ???? ???? }
查看全部 -
關(guān)于響應(yīng)處理
查看全部 -
關(guān)于請(qǐng)求處理
查看全部 -
頁面請(qǐng)求……
查看全部 -
hello.index
查看全部 -
頂層類創(chuàng)建
查看全部 -
請(qǐng)求流程圖
查看全部 -
成功頁面……
查看全部 -
config/web.php
查看全部 -
phpStudy
查看全部 -
requirements.php
查看全部 -
下載頁面……
查看全部 -
unset刪除關(guān)聯(lián)結(jié)果查詢緩存,with()方法減少查詢次數(shù),提高性能
查看全部
舉報(bào)
0/150
提交
取消