2012-11-11 155 views
1

我使用的基本URL在代码点火器是这样的:BASE_URL笨溶液

<a href="<?=base_url()?>../../includes/images/logo_fosss.png"> 

上面的代码正常运行。

但有时这个代码给出了一个错误,代码必须像这样的改变:

<a href="<?=base_url()?>../../../includes/images/logo_fosss.png"> 

我已经把一个文件夹“包括”在根(同一地点级别应用程序和系统)。

我的代码有什么问题?

回答

2

base_url()应该用于绝对网址。

如果您包含../您表示的网址是相对

我觉得你的代码应该是这样的:

<a href="<?=base_url()?>includes/images/logo_fosss.png"> 

或像这样:

<a href="<?=base_url()?>/includes/images/logo_fosss.png"> 

确保您包括文件夹在你的笨的根文件夹中安装。

欲了解更多信息,请参阅这篇文章:

http://www.webdevelopersnotes.com/design/relative_and_absolute_urls.php3

+0

感谢您的回答,它正常运行:d –

+0

不客气;)很乐意帮忙! – emman