[英]how to remove codeigniter functions from base url when routing
I routed my controller function and suddenly the function name is added to base URL, how can I remove this? 我路由了控制器函数,然后突然将函数名称添加到基本URL中,如何删除它?
$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. 然后,所有突然的编辑博客都添加到基本URL,并且我的外部文件显示错误。
<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! 请帮助我,我们将不胜感激!
You should change your URL's to: 您应该将网址更改为:
<script src="<?php echo base_url('assests/vendor/slick/slick.min.js'); ?>">
Actually base_url
is set in your applications/config.php
file. 实际上
base_url
是在您的applications/config.php
文件中设置的。 -> config['base_url']
. ->
config['base_url']
。 It MUST include trailing slash 必须包含斜线
You need to verify 1 things: 您需要验证1件事:
$config['base_url'] = 'application/path/';
$config['base_url'] = 'application/path/';
like http://example.com/
or http://localhost/applicationName/
http://example.com/
或http://localhost/applicationName/
Now you should use urls like 现在您应该使用类似
In this way, it will generate correct urls. 这样,它将生成正确的URL。
in your config file: 在您的配置文件中:
$config['base_url'] = ' http://test.com '; $ config ['base_url'] =' http://test.com ';
when you call out the base_url() . 当您调出base_url()时 。 You can use this :
您可以使用:
<script src="<?= base_url().'/assests/vendor/slick/slick.min.js'; ?>">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.