锚标记中的CodeIgniter base_url()问题

时间:2016-08-03 11:25:54

标签: php codeigniter base-url

我想点击我的徽标时加载我的主页(base_url)。

基本网址 - (http://localhost:8888/adminpanel/
当我在<a href="<?php echo base_url(); ?>"之类的锚标记中使用base_url()函数时,它会将我带到(http://localhost:8888/adminpanel/index.html)。

实际上,我无法在 adminpanel 文件夹中的任何位置找到此index.html。

所以朋友请帮我找一个解决方案。提前致谢。 :)

3 个答案:

答案 0 :(得分:0)

好吧,我知道了,请你试试

<a class="navbar-brand" href="<?php echo base_url();?>blog"><img src="<?php echo base_url()?>assets/img/ro.jpg" class="img-responsive" alt="" title=""></a>

不要在函数内写入你的url 试试这个

答案 1 :(得分:0)

如果您想要访问主页,可以使用<?php echo site_url()?> base_url用简单的单词用于获取css或图像所需的基本路径

如果您的帖子为http://www.example.com,则可以<?php echo site_url()?>

如果您想转到http://www.example.com/index.php/dashboard,可以<?php echo site_url('dashboard'); ?> 在config.php中的位置

$config['base_url'] = '';
$config['index_page'] = 'index.php';

尝试上述事情。

有关site_url和base_url的更多说明,请点击此处 what is the difference between site_url() and base_url()?

答案 2 :(得分:0)

在config.php中设置以下内容:

$config['base_url'] = 'http://example.com/'; // Set your Home URL

如果您使用mod_rewrite而不是更改以下..

$config['index_page'] = '';
相关问题