1、将CSS放在index.php 即项目根目录下:
设置config文件
$config['base_url'] = 'http://localhost/CI5NEWS/';
2、在controller下输出head 为名的views文件:
class Allnews extends CI_Controller
{
function index()
{
$this->load->helper('url');
$this->load->view('head');
}
}
3、在view中
<link rel="stylesheet" href="<?php echo base_url('css/css.css')?>">
<link rel="stylesheet" href="<?php echo base_url('css/sqlgunclass.css')?>">
这样子引入css