How to Set Base URL in Yii Framework

后端 未结 7 1900
情深已故
情深已故 2021-02-15 00:48

When I do

print_r(Yii::app()->request->baseUrl)

I get an empty string. A post on the Yii forum says this is blank by default. How can I c

7条回答
  •  一个人的身影
    2021-02-15 01:15

    You can edit /path/to/application/protected/config/main.php to change the default value. Add a request component, and configure baseUrl porperty.

    return array(
        ...
        'components' => array(
            ...
            'request' => array(
                'baseUrl' => 'http://www.example.com',
            ),
        ),
    );
    

提交回复
热议问题