Get Base Url YII Framework
echo Yii::app()->request->baseUrl."<br/>" ;
print_r(Yii::app()->request->baseUrl);
echo "<br/>";
var_dump(Yii::app()->getBaseUrl(true));
echo "<br/>";
echo Yii::app()->request->getBaseUrl(true);
You're right, you can't use the Yii::app() methods inside the config's return array, but you can use
Yii::getPathOfAlias()
outside. Something like this might work:
$webroot = Yii::getPathOfAlias('webroot');
return array(
...
'params'=>array(
'paths' => array(
'imageTemp'=> $webroot.'/files/temp-',
'image'=> $webroot.'/files/',
...
),
),
);
return array(
...
'urls'=>array(
'paths' => array(
'imageTemp'=> '/files/temp-',
'image'=> '/files/',
...
),
),
);
No comments:
Post a Comment