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.

  • 相关阅读:
    shell
    梯度,也即该物理参数的变化率,导数
    一些石油类核心期刊
    泰勒展开
    向量范数
    添加打印机
    泛函
    9.3.4 BeaufitulSoup4
    9.3.3 scrapy 框架
    9.3.2 网页爬虫
  • 原文地址:https://www.cnblogs.com/rainblack/p/5364481.html
Copyright © 2011-2022 走看看