【发布时间】:2014-07-28 09:52:20
【问题描述】:
我正在尝试使用 codeigniter 在我的桌子上显示 css,但它不起作用。如果我在我的 html 的标题部分添加 css,它可以工作,但问题是当我为 css 创建一个单独的文件夹时,设计不起作用。我按照网上的例子做的很正确。
这是我在视图中的代码:
<html>
<head>
<title>No title</title>
<link rel="stylesheet" href=<?php echo base_url(); ?>"css/style.css" type="text/css" media="screen" charset="utf-8">
</head>
<body>
<div id="container">
<h4> Super pagination with CodeIgniter</h4>
<?php echo $this->table->generate($records); ?>
<?php echo $this->pagination->create_links(); ?>
</div>
</body>
</html>
这是我在 Controller 中的代码:
<?php
class Site extends CI_Controller {
function __construct() {
parent::__construct();
}
function index() {
$this->load->library('pagination');
$this->load->library('table');
$config['base_url']='http://localhost:81/nine/index.php/site/index';
$config['total_rows']=$this->db->get('data')->num_rows();
$config['per_page']=1;
$config['num_links']=20;
$config['full_tag_open']='<div id="pagination">';
$config['full_tag_close']='</div>';
$this->pagination->initialize($config);
$data['records']=$this->db->get('data', $config['per_page'], $this->uri->segment(3));
$this->load->view('site_view', $data);
}
}
这是自动加载:
$autoload['libraries'] = array('database');
$autoload['helper'] = array('url');
这是配置
$config['base_url'] = 'http://localhost:81/nine/';
这是数据库
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'datadb';
我不知道问题是否出在 codeigniter 的版本上。我使用的是 2.2.0,而在线是 1.7.2。
应该是……
【问题讨论】:
标签: php html css codeigniter