如何在CodeIgniter中包含CSS文件? [英] How can I include the CSS file in CodeIgniter?

查看:104
本文介绍了如何在CodeIgniter中包含CSS文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序文件夹所在的根目录中创建了一个资源文件夹。

I have make a assets folder in root directory where application folder exist. now I have assets sibling to application.

现在,当我尝试打开 http://localhost/CodeIgniter/assets/css/bootstrap.min时

Now when I tried to open http://localhost/CodeIgniter/assets/css/bootstrap.min.css in web-page it's not working.

有人可以帮助我如何使它工作。

Do someone can help me how I can got it worked.

在一个解决方案中,我发现在config文件中写这行将工作,但它不是通过这样做的改变工作。

In a solution I found that writing this line in config file will work but it's not work either by doing this change.

$config['base_url'] = 'http://localhost/CodeIgniter/';

现在请教一下如何在CI中加载CSS文件。

Now please some guideline me how to load CSS file in CI.

解决方案: -

我在我的codeigniter项目中做错了。我再次下载,再次尝试这些东西,没有任何工作。

I have done something wrong in my codeigniter project. I download it again and try these thing again, without anything it's working.

感谢你们所有的人。你可以节省我的时间。

thanks you all of guys. you save my time.

推荐答案


在目录CodeIgniter \system\application\config中打开config.php。

define general css that used. Open "config.php" within directory CodeIgniter\system\application\config.

$config['css'] = 'mystyles.css';

在根应用程序中创建一个名为mystyles.css的文件:\CodeIgniter。

Create a file named mystyles.css within root application: \CodeIgniter.

$this->load->helper('url');       
$data['css']        = $this->config->item('css'); 

您可以在此类视图页面中加载css。

You can load css in views pages like this.

这篇关于如何在CodeIgniter中包含CSS文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆