webyjh 2012-01-11 20:02:58 6445次浏览 6条回复 0 0 0

请教Yii::app()->request->baseUrl和 Yii::app()->baseUrl这两个东西有区别吗?

  • 回复于 2012-01-11 21:01 举报

    一样的。。第二个是第一个的捷径

  • 回复于 2012-01-11 21:36 举报

    3Q,我经常偷懒就写成第二个,呵呵

  • 回复于 2012-01-17 10:53 举报

    不一样的

  • 回复于 2012-01-17 11:03 举报

    请教有什么不一样呢?

  • 回复于 2012-01-19 17:39 举报

    一样的 看源代码

    /**
    * Returns the relative URL for the application.
    * This is a shortcut method to {@link CHttpRequest::getBaseUrl()}.
    * @param boolean $absolute whether to return an absolute URL. Defaults to false, meaning returning a relative one.
    * @return string the relative URL for the application
    * @see CHttpRequest::getBaseUrl()
    */
    public function getBaseUrl($absolute=false)
    {
        return $this->getRequest()->getBaseUrl($absolute);
    }
    
  • 回复于 2012-01-20 06:20 举报

    3Q,解决了。thanks

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