【发布时间】:2021-08-22 02:03:00
【问题描述】:
我在代码点火器中有这样的目录结构:
Appsite
-website
-application
-images
当我访问 index.php 中的图像时,我使用了:
<img src="http://localhost/Appsite/website/images/images.PNG"
href 是:
<li class=""><a href="http://localhos/tAppsite/website/index.php/home/">Home</a></li>
我认为在代码点火器中访问图像或库时包含http://localhost 不是一个好习惯。所以我试图改变config.php中的$config['base_url']
给$config['base_url'] = "http://".$_SERVER["HTTP_HOST"]."/";
现在我更新了我的图像源和其他库源,我删除了 localhost 和我的目录文件夹的名称:
<img src="images/images.PNG”>
<li class=""><a href= <?php echo base_url;?> /website/index.php/home/">Home</a></li>
但我得到了错误。它说找不到对象。有人可以帮助我吗?
【问题讨论】:
标签: php html codeigniter codeigniter-2 base-url