【发布时间】:2020-05-17 16:59:13
【问题描述】:
尝试使用 php 链接到与我当前所在的文件不同的文件夹中的图像,但图像未显示。
这是路径文件:
<?php
if (!defined("ROOT_PATH")) define ("ROOT_PATH", realpath(dirname(__FILE__)));
if (!defined("BASE_URL")) define ("BASE_URL", "http://localhost/stnresp");
?>
这是我目前正在使用的代码:
<div class="logo-image">
<a href="<?php echo BASE_URL . '/index.php'; ?>"><img class="header-logo" src="<?php echo ROOT_PATH . '/assets/images/stn-logo-cropped.png'; ?>" alt=""></a>
</div>
我不明白为什么根路径没有将链接指向根目录,然后再指向图像?我错过了什么?
谢谢
【问题讨论】: