在资产加载时找不到codeigniter 404

时间:2016-06-12 23:05:54

标签: php twitter-bootstrap codeigniter http-status-code-404

我几个小时都遇到了问题,我无法摆脱它,我正在尝试从我的资产文件夹加载我的引导程序文件,但是我收到了404错误。

正如您所见,我的资源文件夹位于我的根文件夹中

enter image description here

我用头部的base_url函数调用它:

<link href="<?php echo base_url('assets/css/bootstrap.css'); ?>" rel="stylesheet">

我的控制台出现了这个错误:

获取http://127.0.0.1/WeBusy/assets/css/bootstrap.css

获取http://127.0.0.1/WeBusy/assets/js/bootstrap.min.js 404(未找到)

修改

我注意到与文件相关的所有内容都失败了,例如,如果我自动加载库会话,我有这样的错误:

Message: mkdir(): Invalid path
Filename: drivers/Session_files_driver.php

Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.
Filename: C:\Users\User\Dropbox\WeBusy\system\libraries\Session\drivers\Session_files_driver.php

2 个答案:

答案 0 :(得分:0)

我认为您已将基本网址留空

$config['base_url'] = '';

更改为

WARNING: You MUST set this value!

$config['base_url'] = 'http://localhost/WeBusy/';

如果您使用的是CI3版本,则必须设置

您可能需要使用index.php

<link href="<?php echo base_url('index.php/assets/css/bootstrap.css'); ?>" rel="stylesheet">

答案 1 :(得分:0)

像这样访问它:

<link href="<?php echo base_url(); ?>assets/css/bootstrap.css" rel="stylesheet">
相关问题