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

转载于:https://www.cnblogs.com/debmzhang/p/3853838.html

yii redirect相关推荐

  1. Yii框架的form处理

    Yii是重量级框架,类似于同ruby on rails,django是同一类型的框架,所以其有的特点在其他框架上都存在,但吸引我研究它的是官方文档凭什么说"Yii 是一个基于组件的高性能 P ...

  2. nginx与mysql传输过程_某互联网企业技术发展史(四)配置nginx和mysql兼容Yii框架,上传网站并调试成功...

    昨天安装好了php.nginx和squid,今天配置mysql和nginx,使nginx兼容Yii框架,并上传网站,将网站调试和配置好. 1, 首先配置下php的时区 # vi /etc/php.in ...

  3. 某互联网企业技术发展史(四)配置nginx和mysql兼容Yii框架,上传网站并调试成功...

    昨天安装好了php.nginx和squid,今天配置mysql和nginx,使nginx兼容Yii框架,并上传网站,将网站调试和配置好. 1, 首先配置下php的时区 # vi /etc/php.in ...

  4. yii框架相关知识(转)

    2019独角兽企业重金招聘Python工程师标准>>> db组件 'schemaCachingDuration'=>3600, 为什么不起做用?需要开缓存 如何在页面下边显示s ...

  5. YII用户注冊和用户登录(五)之进行session和cookie分析 ,并在前后区分session和cookie...

    5 进行session和cookie分析 ,并在前后区分session和cookie: 记住登录状态 这样下次再登录站点的时候.就不用反复输入username和password. 是浏览器的cooki ...

  6. Bug之Yii继承类的

    问题 Yii报错显示redirect()函数没有  不可能啊 原因 UserController->BaseWebController->Controller 我使用的controller ...

  7. yii 1.4 constant.php,yii 中设置提示成功信息,错误提示信息,警告信息

    方法一: Yii::app()->user->setFlash('success',"Data saved!"); 设置键值名为success的临时信息.在getFla ...

  8. yii学习笔记--url解析

    在通过yiic命令生成了一个app之后,我们通过浏览器访问会看到这样的一个页面. 点击home时,url为:http://localhost/blog/index.php?r=site/index 点 ...

  9. Yii 用户登陆机制

    Yii 生成应用时已经提供了最基础的用户登陆机制.我们用 Yii 生成一个新的应用,进入 protected/components 目录,我们可以看到 UserIdentity.php 文件,里面的 ...

最新文章

  1. [转]mysql 数据类型
  2. 号称下一代监控系统?
  3. python 跳出两层循环,跳出多层循环
  4. phalcon系列(1) hello phalcon
  5. 傅里叶变换函数FFT的使用方法
  6. 智能化网络管理 为企业信息化保驾护航
  7. 【ASP.NET Step by Step】之十六至二十三 Inserting, Updating, and Deleting Data
  8. 快速排序算法的优化思路总结
  9. mysql 什么时候用内连接_mysql显示内连接和隐式内连接的区别,什么时候非要用到显示内连接。...
  10. excel冻结标题栏,让标题栏不滚动的方法
  11. C++的 RTTI 观念和用途
  12. Python3面向对象:实例(instance)
  13. C语言练习:第二大整数
  14. Cobalt Strike Profile 学习记录
  15. 结构梁配筋最牛插件_多高层钢筋混凝土结构最困惑的29个问题及方法解析全汇总...
  16. 什么是集群农场渲染?一文带你快速了解
  17. 携程线上测评测试题目,答案解析
  18. Win10 企业版 2016 长期服务版激活
  19. Newline —— CRLF、LF、CR回车和换行
  20. 复利计算器app发布

热门文章

  1. 海豚php添加一行,添加表单项通用方法-海豚PHP1.0.6完全开发手册-基于ThinkPHP5.0.10的快速开发框架...
  2. php this 代表什么,php中$this-)是什么意思?
  3. FPGA/IC技术交流2020
  4. HDLBits 系列(21)LFSR(线性反馈移位寄存器)
  5. 基于比特币现金的Token逐梦而来
  6. 详解Javascript中的Object对象
  7. 关于编译安装nginx的一些问题
  8. 使用JCOOKIES创建http cookie
  9. 分享:python,限制任意函数,线程的执行时间或根据条件终止.
  10. [Drupal] How to display the month in French words.