dsjgk330337 2016-11-08 05:44
浏览 313
已采纳

如何在codeigniter中的config.php文件中设置config_base url?

I am beginner in Codeigniter. I have downloaded the software and tried to configure it. How can I configure a base url to use in codeigniter?

  • 写回答

5条回答 默认 最新

  • dt102282 2016-11-08 05:53
    关注

    You should got to this file path

    Codeigniter/applications/config/config.php

    Search for this line that contains

    $config['base_url'] = ""
    

    Then your base_url should be

    $config['base_url'] = "http://yoursite.com/"
    

    If xampp, it should be

    $config['base_url'] = "http://localhost/yoursite/"
    

    And if wamp, it should be

    $config['base_url'] = "http://www/yoursite/"
    

    Note that yoursite is the filename of the site folder you have in htdocs or www folder

    When you make use of <?php echo base_url(directory/file_name); ?> In your views, it should output something like:

     "http://localhost/yoursite.com/directory/file_name"
    

    That should do the trick

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?