zoukankan      html  css  js  c++  java
  • Yii的常用URL和渲染方法

    当前页面url  Yii::app()->request->url;
    跳转前一个页面url $this->redirect(Yii::app()->request->urlReferrer);
    根目录URL Yii::app()->baseUrl 或 Yii::app()->request->baseUrl; 
    自定义URL $this->createUrl('post/read',array('id'=>100))或Yii::app()->createUrl();


    如果浏览器重定位到登录页面,而且登录成功,我们将重定位浏览器到引起验证失败的页面。我们怎么知道这个值呢?我们可以通过用户部件的returnUrl 属性获得。我们因此可以用如下执行重定向:

    Yii::app()->request->redirect(Yii::app()->user->returnUrl);


    渲染视图 $this->render('view', array('attribute1'=>'value1','attribute2'=>'value2'));
    跳转页面 $this->redirect(array('route','attribute1'=>'value1','attribute2'=>'value2'));
    创建小组件$this->beginWidget(string $className, array $properties=array ( ))
              $this->endWidget();
    局部渲染 renderPartial('view', array('attribute1'=>'value1','attribute2'=>'value2'));
             This method differs from render() in that it does not apply a layout to the rendered result. It is thus mostly used in rendering a partial view, or an AJAX response.

  • 相关阅读:
    zabbix 微信告警
    mongodb 的数据备份与还原
    Templates
    Rsyslog 基本结构
    matplotlib绘图学习
    pyhon 简介
    Pygame (Python编程从入门到实践)
    AttributeError: 'pygame.Surface' object has no attribute 'rect'
    PYTHON CLIENT API
    SALT.STATES.CMD模块
  • 原文地址:https://www.cnblogs.com/rainblack/p/5364481.html
Copyright © 2011-2022 走看看