ci 框架 index.php以及 js css 路径问题

来源:互联网 发布:获取网站整站源码工具 编辑:程序博客网 时间:2024/06/18 09:00


问题: 登录页面的form表单无法提交,显示路径not found。 想到用, 在action 路径中加入index.php后 可以跳转。可是并没有根本解决问题,在引入css,js文件时,全路径不对,发现所有路径都加了index.php,无法显示。


解决:新建.htaccess 文件,注意.htaccess 文件路径,里面写上:

RewriteEngine on
RewriteCond $1 !^(index\.php|upload|public|apidoc|new_admin)
RewriteRule ^(.*)$ /365tang/index.php/$1 [L]


问题:css js路径 是全路径,这样本地、服务器同步困难。

解决:页面头部 加:

<head>
<base href="<?=base_url();?>" />

</head>

控制页面 构造函数:

    function __construct()
    {  
        $this->load->helper('url');
    }

0 0
原创粉丝点击