zoukankan      html  css  js  c++  java
  • YII contoller控制器之间跳转的方法redirect

       

    一个contoller CustomerController里怎么调用另一个controller里的action,Acontoller调用SiteContoller的actionShow($id), url显示上是Customer/index

    $control=Yii::app()->runController('site/show/id/2');



    不带参数的actionShow()

    $control=Yii::app()->runController('site/show');


    redirect使用方法

    $this->redirect(array('/site/contact','id'=>12));
    //http://www.kuitao8.com/testwebap/index.php?r=site/contact&id=12
    
    $this->redirect(array('site/contact','id'=>'idv','name'=>'namev'));
    //http://www.kuitao8.com/testwebap/index.php?r=site/contact&id=idv&name=namev
    
    $this->redirect(array('site/contact','v1','v2','v3'));
    //http://www.kuitao8.com/testwebap/index.php?r=site/contact&0=v1&1=v2&2=v3
    
    $this->redirect(array('site/contact','v1','v2','v3','#'=>'ttt'));
    //带anchor的  http://www.kuitao8.com/testwebap/index.php?r=site/contact&0=v1&1=v2&2=v3#ttt

    跳转到一个绝对路径

    $this->redirect('http://www.baidu.com');
  • 相关阅读:
    吉他谱----see you again
    web----tcp三次握手
    python shell 执行
    python jieba
    NLP gensim 相似度计算
    linux shell expect 自动交互脚本
    docker 安装镜像
    数据库 MySQL 数据导入导出
    爬虫 puppeteer
    Linux ssh相关
  • 原文地址:https://www.cnblogs.com/ylei11/p/6610596.html
Copyright © 2011-2022 走看看