site_url()在codeigniter框架中不能正常工作 [英] site_url() is not work properly in codeigniter framework
本文介绍了site_url()在codeigniter框架中不能正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下工作无法正常工作codeigniter框架...
following work not work properly for codeigniter framework...
它的我的视图:
<?php
echo '<h2>'.$news_item['title'].'</h2>';
echo $news_item['text']."</br></br>";
?>
<a href="<?php site_url("news"); ?>" > Back to Main </a></br></br>
推荐答案
您应该在控制器构造方法中加载了url_helper或者在调用你的视图的函数中,像这样 $ this-> load-> helper('url')
,然后在你的视图中, $ c> site_url()
You should have loaded the url_helper in your controller construct method or in the function that calls your view like this $this->load->helper('url')
and then in your view you should echo the site_url()
<a href="<?php echo site_url("news"); ?>" > Back to Main </a></br></br>`
这篇关于site_url()在codeigniter框架中不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文