大麦城 发表于 2013-12-23 11:52:36

CI 里 前端用bootstrap,样式出不来,什么情况

图在附件里,页面里<link rel="stylesheet" type="text/css" href="http://localhost/ciedu/application/themes/default/css/bootstrap.min.css">
这个地址是对的没错


大麦城 发表于 2013-12-23 12:08:23

源码是这样写的
<link rel="stylesheet" type="text/css" href="<?php echo base_url('application/themes/default/css/bootstrap.min.css'); ?>">

生成网页后变成
<link rel="stylesheet" type="text/css" >
没错啊,为什么调出不来

大麦城 发表于 2013-12-23 12:09:32


原码是这样写的
<link rel="stylesheet" type="text/css" href="<?php echo base_url('application/themes/default/css/bootstrap.min.css'); ?>">

生成网页后变成看源文件
<link rel="stylesheet" type="text/css" >
没错啊,为什么调出不来

Bobby 发表于 2013-12-23 12:41:44

样式为啥要放在application中?

ahkxhyl 发表于 2013-12-23 13:03:54

路径不对~~~~~~~~~~

IvanCI 发表于 2013-12-23 13:58:08

http://codeigniter.org.cn/user_guide/general/urls.html 手册

默认情况下,index.php 文件将被包含在你的 URL 中:

example.com/index.php/news/article/my_article
你可以很容易的通过 .htaccess 文件来设置一些简单的规则删除它。下面是一个例子,使用“negative”方法将非指定内容进行重定向:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f      //此处有大坑。加上这句可保证一般css、js文件正常加载。(注意删掉这句注释哦)
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1

注意:如果你的项目不在根目录请把上面这一句改为:RewriteRule ^(.*)$ index.php/$1
在上面的例子中,可以实现任何非 index.php、images 和 robots.txt 的 HTTP 请求都被指向 index.php。

所以还是先看看手册~ 虽然容易上手~ 有时候还是浏览一下~

大麦城 发表于 2013-12-25 09:56:59

谢谢,重定向的问题,哎,大坑啊,设置.htaccess 文件,有搜到网易一片文章写rewrite的,复制粘贴就解决了,之前硬是搞了几个小时,疯了,好像很多人碰到,期待新版ci解决这个问题。只少让新手不要这么崩溃去解决这个问题。

ahkxhyl 发表于 2014-2-21 09:52:20

路径明显不对~~~~~~~
页: [1]
查看完整版本: CI 里 前端用bootstrap,样式出不来,什么情况