CodeIgnite中添加Css和Js
首先把css, js文件或者文件夾放在同system同一級別的目錄上,這里與system同級別目錄的為css和js目錄。
然后在config.php中設置
$config['base_url'] = "http://localhost:8080/";
$config['css'] = "main.css";
$config['js'] = "main.js";
在system同一目錄下建立.htaccess文件
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css|js)
RewriteRule ^(.*)$ /index.php/$1 [L]
在視圖文件里可以直接引用css了
<link href="<?php echo base_url();?>css/main.css" rel="stylesheet" type="text/css" />
然后在config.php中設置
$config['base_url'] = "http://localhost:8080/";
$config['css'] = "main.css";
$config['js'] = "main.js";
在system同一目錄下建立.htaccess文件
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css|js)
RewriteRule ^(.*)$ /index.php/$1 [L]
在視圖文件里可以直接引用css了
<link href="<?php echo base_url();?>css/main.css" rel="stylesheet" type="text/css" />
posted on 2010-06-05 21:32 草原上的駱駝 閱讀(416) 評論(0) 編輯 收藏 所屬分類: PHP