kohana自定义site_url去除index.php

来源:互联网 发布:千里眼定位软件 编辑:程序博客网 时间:2024/06/08 05:05

bootstrap.php配置文件中可以加上以下代码,对默认base_url去除index.php

//自定义常量,清除index.php
define('SITE_URLS', set_site_url());
function set_site_url()
{
return str_replace("index.php/", "", Kohana::$base_url);
}


视图view中调用方法
<?php
echo SITE_URLS;
?>
<script type="text/javascript" SRC="<?php echo SITE_URLS?>assets/admin/js/flot/jquery.flot.min.js"></script>
原创粉丝点击