鎏金-九月 发表于 2012-3-31 15:45:18

图片显示不出来呢?


我的图片地址是这里
http://localhost/WZCI/images/show/img/18_mix.jpg
我在控制器里用base_url()取得基本地址加上/images/show/img/18_mix.jpg的时候却是这样
http://localhost/WZCI/index.php/images/show/img/18_mix.jpg
请问我怎么获得没有index.php的文件的路径,还是有别的方法解决问题?

Hex 发表于 2012-3-31 16:01:59

base_url() 不应该返回 index.php

鎏金-九月 发表于 2012-3-31 16:19:12

本帖最后由 鎏金-九月 于 2012-3-31 18:09 编辑

<img src="images/show/img/18_mix.jpg"……当我调用这个地址时候
http://localhost/WZCI/index.php/home
图片显示这个地址
http://localhost/WZCI/index.php/images/show/img/18_mix.jpg
不能正常显示图片

当我调用这个地址
http://localhost/WZCI/
图片地址是这个可以正常显示
http://localhost/WZCI/images/show/img/18_mix.jpg
请问我怎么解决

鎏金-九月 发表于 2012-4-1 15:08:19

本帖最后由 鎏金-九月 于 2012-4-1 15:32 编辑

有人帮我回答一下吗,当我指定模块指定方法的时候、
<img src="images/show/img/18_mix.jpg"

当输入URI   http://localhost/WZCI/index.php/home/index/
得到的路径是这样 http://localhost/WZCI/index.php/images/show/img/18_mix.jpg

当输入URI   http://localhost/WZCI/index.php
得到的是http://localhost/WZCI/index.php/images/show/img/18_mix.jpg

请问我制定了控制器和模块,我调用图片的路径就有问题。
请哪位高手提醒我解决的方法


Hex 发表于 2012-4-1 16:33:47

URL 请使用绝对地址,不要用相对地址,比如:
<img src="http://domain.com/images/show/img/18_mix.jpg" />

鎏金-九月 发表于 2012-4-1 16:44:37

实际应用中要求不能使用绝对地址,请问相对地址的解决方法

Hex 发表于 2012-4-1 16:58:58

鎏金-九月 发表于 2012-4-1 16:44 static/image/common/back.gif
实际应用中要求不能使用绝对地址,请问相对地址的解决方法

CI 必须用绝对 URL,这是规定。

鎏金-九月 发表于 2012-4-1 17:35:48

问题解决了,在头部加一行代码就OK了
<base href="<?php echo base_url()?>"/>
页: [1]
查看完整版本: 图片显示不出来呢?