yii2 redirect重定向


redirect使用方法

$this->redirect(array('/site/contact','id'=>12));
//http://www.kuitao8.com/testwebap/index.php?r=site/contact&id=12
 
$this->redirect(array('site/contact','id'=>'idv','name'=>'namev'));
//http://www.kuitao8.com/testwebap/index.php?r=site/contact&id=idv&name=namev
 
$this->redirect(array('site/contact','v1','v2','v3'));
//http://www.kuitao8.com/testwebap/index.php?r=site/contact&0=v1&1=v2&2=v3
 
$this->redirect(array('site/contact','v1','v2','v3','#'=>'ttt'));
//帶anchor的  http://www.kuitao8.com/testwebap/index.php?r=site/contact&0=v1&1=v2&2=v3#ttt

跳轉到一個絕對路徑

$this->redirect('http://www.baidu.com');

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM