dongyata3336 2018-11-06 10:01
浏览 54
已采纳

如何在路由时从基本URL中删除codeigniter函数

I routed my controller function and suddenly the function name is added to base URL, how can I remove this?

 $route['editblog/(:num)']='Code/editblog/$1';

Then all of the sudden edit blogs are added to base URL and my external files are showing an error.

<script src="assests/vendor/slick/slick.min.js">

It shows:

<script src="editblog/assests/vendor/slick/slick.min.js">

Please help me, help will be highly appreciated!

  • 写回答

3条回答 默认 最新

  • doubu7425 2018-11-06 10:47
    关注

    You need to verify 1 things:

    • application/config.php $config['base_url'] = 'application/path/'; like http://example.com/ or http://localhost/applicationName/

    Now you should use urls like

    • base_url('assets/js/filename/js');
    • base_url('controller/action/parameters');

    In this way, it will generate correct urls.

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

报告相同问题?