的header.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/Contents/css/bootstrap.min.css" rel="stylesheet">
<link href="/Contents/fonts/css/font-awesome.min.css" rel="stylesheet">
<link href="/Contents/css/animate.min.css" rel="stylesheet">
<link href="/Contents/css/custom.css" rel="stylesheet">
<link href="/Contents/css/icheck/flat/green.css" rel="stylesheet">
<script src="/Contents/js/jquery.min.js"></script>
</head>
登录视图
<body style="background:#F7F7F7;">
....Html...
</body>
</html>
登录控制器
<?php
class loginController extends CI_Controller {
public function login() {
$this->load->View("template/header");
$this->load->View("login_view");
}
}
?>
内容文件夹存在于根目录中。以下是结构
当我在浏览器中检查时... css和js文件无法加载。请提出纠正措施
答案 0 :(得分:-1)
为每个链接添加base_url()
,例如
link href="<?= base_url("Contents/css/bootstrap.min.css") ?>" rel="stylesheet">
在所有链接中更改它。