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的更多相关文章

  1. Yii笔记---redirect重定向

    Yii的redirect方法在CControler与CHttpRequest之中都有被定义,CController中的redirect调用了CHttpRequest中的redirect方法.我们平常调 ...

  2. Yii url createUrl redirect相关

    一篇文章: 在yii中明明白白生成网址: 在Yii中经常要生成URL,不管是为了自动跳转还是仅仅是一个链接.下面对Yii中的URL生成做了一个总结.提示:以下controllerX代表控制器X,act ...

  3. YII contoller控制器之间跳转的方法redirect

    一个contoller CustomerController里怎么调用另一个controller里的action,Acontoller调用SiteContoller的actionShow($id), ...

  4. Yii rbac原理和实践

    Yii框架中集成分层的 RBAC,代码位于vendor\yiisoft\yii2\rbac中,rbac工作原理分为两部分,建立授权数据和进行权限检查. 如上,一个角色拥有某个权限,如果希望用户拥有这个 ...

  5. 使用 OAuth2-Server-php 在 Yii 框架上搭建 OAuth2 Server

    原文转自 http://www.cnblogs.com/ldms/p/4565547.html Yii 有很多 extension 可以使用,在查看了 Yii 官网上提供的与 OAuth 相关的扩展后 ...

  6. yii create url (二)

    在Yii中经常要生成URL,不管是为了自动跳转还是仅仅是一个链接.下面对Yii中的URL生成做了一个总结.提示:以下controllerX代表控制器X,actionX代表方法X.在Controller ...

  7. yii create url (一)

    1.$this->redirect这里的$this是当前的controller.可能是应用程序的也 可能是模块下的 这里仅将解一下第一个参能是url,当url是一个字符串时,它会自己动跳转 如$ ...

  8. Yii源码阅读笔记(二十八)

    Yii/web中的Controller类,实现参数绑定,启动csrf验证功能,重定向页面功能: namespace yii\web; use Yii; use yii\base\InlineActio ...

  9. 在Yii用createUrl中明明白白生成网址

    在Yii中经常要生成URL,不管是为了自动跳转还是仅仅是一个链接.下面对Yii中的URL生成做了一个总结.提示:以下controllerX代表控制器X,actionX代表方法X.在Controller ...

随机推荐

  1. php 获取域名的whois 信息

    首先先了解几个文件操作函数: fwrite() 函数写入文件(可安全用于二进制文件). fwrite() 把 string 的内容写入文件指针 file 处. 如果指定了 length,当写入了 le ...

  2. strcpy实现

    #include <iostream> using namespace std; char *strcpy(char *strDest, const char *strSrc) { if ...

  3. python json string和dict的转化

    __author__ = 'SRC_TJ_XiaoqingZhang' import json data1 = {'b': 789, 'c': 456, 'a': 123} encode_json = ...

  4. cocos2dx调度器scheduler

    / 让帧循环调用this->update(float dt)函数 // scheduleUpdate(); // 让帧循环去调用制定的函数,时间还是1/60秒 // schedule(sched ...

  5. 在apache上报错“The _imaging C module is not installed”

    我的环境是python2.7.8.django1.6.4.apache2.2. 问题:在django自带的runserver环境下没有任何报错,但是配置在apache上出现了 “The _imagin ...

  6. bzoj1233: [Usaco2009Open]干草堆tower

    Description 奶牛们讨厌黑暗. 为了调整牛棚顶的电灯的亮度,Bessie必须建一座干草堆使得她能够爬上去够到灯泡 .一共有N大包的干草(1<=N<=100000)(从1到N编号) ...

  7. 大神眼中的React Native--备用

    当我第一次尝试ReactNative的时候,我觉得这只是网页开发者涉足原生移动应用领域的歪门邪道. 我认为一个js开发者可以使用javascript来构建iPhone应用确实是一件很酷的事情,但是我很 ...

  8. 工作总结:VS2010/MFC编程入门之十六(对话框:消息对话框)

    原文地址:http://www.jizhuomi.com/software/171.html 我们在使用Windows系统的过程中经常会见到消息对话框,提示我们有异常发生或提出询问等.因为在软件开发中 ...

  9. BZOJ 3575 道路堵塞

    Description A国有N座城市,依次标为1到N.同时,在这N座城市间有M条单向道路,每条道路的长度是一个正整数.现在,A国交通部指定了一条从城市1到城市N的路径,并且保证这条路径的长度是所有从 ...

  10. 【转】Jollen 的 Android 教學,#12: 如何建立選單 Menu

    原文网址:http://www.jollen.org/blog/2009/06/jollen-android-programming-12.html Android應用程式的UI可以使用XML來定義, ...