yii redirect
redirect 这个方法是在 CController 里定义的
先来看下官方介绍
redirect() 方法
|
public void redirect(mixed $url, boolean $terminate=true, integer $statusCode=302)
|
||
| $url | mixed | the URL to be redirected to. If the parameter is an array, the first element must be a route to a controller action and the rest are GET parameters in name-value pairs. |
| $terminate | boolean | whether to terminate the current application after calling this method |
| $statusCode | integer | the HTTP status code. Defaults to 302. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10 for details about HTTP status code. |
注意下红色字体, 意思就是说, 如果第一个参数是数组了的话, 那么本次就是使用get方式进行传值
(亲测) 如果第一个参数不是数组的话, 那本次就是 post 传值了
看下例子
return $this->redirect(array(
'/admin/userClientLoginLog/down',
'username' => $username,
'type' => $type,
'date' => $date,
));
上面的例子会进行这样的访问 http://localhost/admin/userClientLoginLog/down/username/$username/type/$type/date/$date
return $this->redirect( '/admin/userClientLoginLog/down', array(
'username' => $username,
'type' => $type,
'date' => $date,
));
上面的例子会进行这样的访问 http://localhost/admin/userClientLoginLog/down
yii redirect的更多相关文章
- Yii笔记---redirect重定向
Yii的redirect方法在CControler与CHttpRequest之中都有被定义,CController中的redirect调用了CHttpRequest中的redirect方法.我们平常调 ...
- Yii url createUrl redirect相关
一篇文章: 在yii中明明白白生成网址: 在Yii中经常要生成URL,不管是为了自动跳转还是仅仅是一个链接.下面对Yii中的URL生成做了一个总结.提示:以下controllerX代表控制器X,act ...
- YII contoller控制器之间跳转的方法redirect
一个contoller CustomerController里怎么调用另一个controller里的action,Acontoller调用SiteContoller的actionShow($id), ...
- Yii rbac原理和实践
Yii框架中集成分层的 RBAC,代码位于vendor\yiisoft\yii2\rbac中,rbac工作原理分为两部分,建立授权数据和进行权限检查. 如上,一个角色拥有某个权限,如果希望用户拥有这个 ...
- 使用 OAuth2-Server-php 在 Yii 框架上搭建 OAuth2 Server
原文转自 http://www.cnblogs.com/ldms/p/4565547.html Yii 有很多 extension 可以使用,在查看了 Yii 官网上提供的与 OAuth 相关的扩展后 ...
- yii create url (二)
在Yii中经常要生成URL,不管是为了自动跳转还是仅仅是一个链接.下面对Yii中的URL生成做了一个总结.提示:以下controllerX代表控制器X,actionX代表方法X.在Controller ...
- yii create url (一)
1.$this->redirect这里的$this是当前的controller.可能是应用程序的也 可能是模块下的 这里仅将解一下第一个参能是url,当url是一个字符串时,它会自己动跳转 如$ ...
- Yii源码阅读笔记(二十八)
Yii/web中的Controller类,实现参数绑定,启动csrf验证功能,重定向页面功能: namespace yii\web; use Yii; use yii\base\InlineActio ...
- 在Yii用createUrl中明明白白生成网址
在Yii中经常要生成URL,不管是为了自动跳转还是仅仅是一个链接.下面对Yii中的URL生成做了一个总结.提示:以下controllerX代表控制器X,actionX代表方法X.在Controller ...
随机推荐
- VIM中文乱码
下面是关于VIM中文乱码问题的解决方法: 打开VIM的配制文件在里面加上一段这样的代码就可以了: set encoding=prc
- DIV+CSS外部字体引用
注意: 由于各个浏览器兼容问题大家还是少用这个,下面是具体的使用方法和效果截图: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN&qu ...
- iOS 取得CGimage字节数据的方法
通过我在网上搜索和总结,目前看来,我发现两种比较方便的方式. 1. CGImage -> CGDataProvider -> CFData -> xx * CGDataProvide ...
- 将日志写入EventLog
将日志写入EventLog 面向Windows的编程人员应该不会对Event Log感到陌生,以至于很多人提到日志,首先想到的就是EventLog.EventLog不仅仅记录了Windows系统自身针 ...
- Dao 处理
1. 写一个基础的接口和类来做基本的操作 /** * */ package com.wolfgang.dao; import java.util.List; /** * @author Adminis ...
- codeforces B. Prison Transfer
题意:输入n,t,c,再输入n个数,然后问有多少个连续区间内的最大值小于等于t; #include <cstdio> #include <cstring> #include & ...
- ios入门之c语言篇——基本函数——1——随机数生成
1.随机数函数 参数返回值解析: 参数: a:int,数字范围最小值: b:int,数字范围最大值: 返回值: 1:闰年: 0:非闰年: 备注: a-b的绝对值不能超过int的最大值(65535); ...
- TinyMCE下载及使用
1.TinyMCE下载 官方下载网址:http://www.tinymce.com/ 简体中文语言包下载:http://www.tinymce.com/i18n/index.php?ctrl=lang ...
- 有关linux下redis overcommit_memory的问题(转)
一.背景 公司的redis有时background save db不成功,通过log发现下面的告警,很可能由它引起的: [13223] 17 Mar 13:18:02.207 # WARNING ov ...
- (转载)mysql 存在该记录则更新,不存在则插入记录的sql
(转载)http://www.codesky.net/article/201003/105754.html 代码如下: INSERT table (auto_id, auto_name) values ...