北京过客 2011-04-22 17:45:05 3292次浏览 4条回复 0 0 0
<?php 
echo Yii::app()->request->baseUrl; 
?>

这个是得到跟目录的 www.com/index.php/site/index 我想得到 www.com/index.php/site/ 是哪个变量

  • 回复于 2011-04-22 17:47 举报

    有一个controller的 属性

  • 回复于 2011-04-22 17:49 举报

    getController() method

    public CController getController() 
    {return} CController the currently active controller 
    
    Source Code: framework/web/CWebApplication.php#434 (show) public function getController()
    {
        return $this->_controller;
    }
    

    由api文档来看 通过 Yii::app()->controller 就可以得到

  • 回复于 2011-04-22 20:15 举报
    Yii::app()->request->scriptUrl
    
  • 回复于 2011-08-02 14:50 举报

    不是在控制器actionSite的方法吗?

您需要登录后才可以回复。登录 | 立即注册