我的路由规则是
'components'=>array(
/*'urlManager'=>array(
'urlFormat'=>'path',
),*/
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>'=>'<controller>/index',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>'
)
现在我想在我的页面中有一个链接到静态网页的img 例如
<a href="www.example.com"><img></a>
然而,此链接重定向到
www.example.com/example.com
我应该添加什么规则,以便只在此链接上重定向到静态页面
我的sitebase是www.example.com
所以Yii生成的任何链接始终是
www.example.com/"something"
答案 0 :(得分:2)
使用CHtml
(所有人推荐)
echo CHtml::link('Yii External Link', "http://www.example.com");
OR
<a href="http://www.example.com"><img></a>