-2
控制器:test.php的頁面加載後,第二次加載CSS。爲什麼?
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Test extends CI_Controller
{
function __construct()
{
parent :: __construct();
$this->load->helper(array('url'));
}
public function index()
{
$this->load->view('header');
$this->load->view('index');
}
}
觀點:index.php文件
<html lang="en">
<head>
<meta charset="utf-8">
<title>bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<link href="<?php echo base_url(); ?>resources/css/style.css" rel="stylesheet" />
</head>
<body>
..........content..........
<script src="<?php echo base_url(); ?>resources/js/jquery.min.js"></script>
</body>
</html>
我使用CodeIgniter的框架來顯示索引文件。當頁面加載時,html代碼顯示正常。但在加載所有js和css文件後,頁面會中斷。我已將頂部的CSS文件和頁面底部的js文件包含在內。
請任何人都幫我解決這個問題。
謝謝
請分享相關代碼 –
您是否在config.php中設置了基本網址,您還需要確保您的資產文件夾位於應用程序外側 – user4419336
是的,我已經在config.php中設置了基本網址,並且還指出了位於外面的文件夾應用程序。 – omkara