为什么
<a id="tray-button"><img id="tray-arrow" src="http://localhost/ric/slideshow/img/button-tray-up.png"/></a>
可以工作,但不是这个
<a id="tray-button"><img id="tray-arrow" src=<?php Yii::app()->baseUrl.'/slideshow/img/button-tray-up.png'?>/></a>
提供的http://localhost/ric
-> 是我的webroot。
这是我的 main.php 的基本路径配置
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
最佳答案
您需要“回显”baseUrl
<a id="tray-button">
<img id="tray-arrow" src="<?php echo Yii::app()->baseUrl; ?>/slideshow/img/button-tray-up.png" />
</a>
关于php - Yii::app()->baseUrl 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14363170/