dow56114 2013-01-16 16:34
浏览 124
已采纳

Yii :: app() - > baseUrl无效

Why

<a id="tray-button"><img id="tray-arrow" src="http://localhost/ric/slideshow/img/button-tray-up.png"/></a>

is working but not this

<a id="tray-button"><img id="tray-arrow" src=<?php Yii::app()->baseUrl.'/slideshow/img/button-tray-up.png'?>/></a>

Provided http://localhost/ric -> is my webroot.

Here is the basepath configuration from my main.php

'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
  • 写回答

2条回答 默认 最新

  • duanbi7204 2013-01-16 16:38
    关注

    You need to "echo" the baseUrl

    <a id="tray-button">
      <img id="tray-arrow" src="<?php echo Yii::app()->baseUrl; ?>/slideshow/img/button-tray-up.png" />
    </a>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?