- 相關推薦
ThinkPHP中redirect用法實例分析
ThinkPHP中redirect如何使用,下面是小編給大家提供的ThinkPHP中redirect用法實例分析,大家可以參考閱讀,更多詳情請關注應屆畢業生考試網。
redirect 重定向的通用語法為:redirect(url,params=array(),delay=0,msg=''),假設當前為默認 HOME分組 Aritcle模塊 insert操作,一些例子如下:
代碼如下:
// 跳轉到 edit 操作
$this->redirect('edit');
// 跳轉到 UserAction下的edit 操作
$this->redirect('User/edit');
// 跳轉到 Admin分組默認模塊默認操作
$this->redirect('Admin/');
// 跳轉到 Admin分組Index模塊view操作
$this->redirect('Admin-Index/view');
// 跳轉到 Admin分組Index模塊view操作,uid參數為1,延遲3秒跳轉
$this->redirect('Admin-Index/view', array('uid'=>1), 3,'頁面跳轉中~')
// 跳轉到 其他OtherApp項目(非分組)的Admin項目分組User模塊view操作
$this->redirect('OtherApp://Admin-User/view');
同項目分組中的URL訪問一樣,redirect 中跨分組跳轉只是多了一個分組項目名稱的概念.
提示:可以在 redirect 中使用路由,redirect 方法的參數用法和 U函數 的用法一致.可參考 U函數 生成URL地址相關部分內容.
希望本文所述對大家基于ThinkPHP的PHP程序設計有所幫助。
【ThinkPHP中redirect用法實例分析】相關文章:
分析thinkphp常見路徑用法分析10-29
Java中的多態用法實例分析10-23
php中return的用法實例分析10-27
php中fsockopen用法實例06-20
Java中的MessageFormat.format用法實例10-23
ThinkPHP中自動驗證07-26
ThinkPHP實現支付寶接口功能實例09-04
php中引用的用法分析06-22