site_url() is not work properly in codeigniter framework

后端 未结 3 999
星月不相逢
星月不相逢 2021-01-23 10:34

The following code does not work properly for the Codeigniter framework...

Its my View:

\'.$news_item[\'title\'].\'

        
相关标签:
3条回答
  • 2021-01-23 11:06

    Try base url

     <a href="<?=base_url("news")?>" > Back to Main </a>
    

    base url return's without any further pages

    refer also: https://stackoverflow.com/a/17079745/7817622

    0 讨论(0)
  • 2021-01-23 11:09

    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>`
    
    0 讨论(0)
  • 2021-01-23 11:11

    Did u load url helper

    Did u specify the site_url in config file... ->Returns your site URL, as specified in your config file. The index.php file (or whatever you have set as your site index_page in your config file) will be added to the URL, as will any URI segments you pass to the function, and the url_suffix as set in your config file.

    If not working try with base_url

    0 讨论(0)
提交回复
热议问题