本文介绍了如何加载JS和CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的CI比较新。因此,我不知道如何加载CSS和JS。我用Google搜索,但未成功
I am newer in CI. So I don't know how to load CSS and JS. I google it but do not success
CI代码
<?php echo base_url(); ?> <link href="<?php echo base_url()."css/bootstrap-cerulean.css"?>" type="text/css" rel="stylesheet">
这是我的目录结构。需要任何配置,它的路径显示在浏览器中,如下所示,但未加载CSS。
This is my directory structure. Need any configuration for it and it path display in browser like below but it not loaded css.
localhost/codeIgniter/css/bootstrap-cerulean.css需要任何帮助,请发表评论,如有需要,我会进一步提供帮助。 / p>
Required any help please comment I will help further if needed.
推荐答案将css / js / images / etc文件夹放在根目录中。这样,您可以将CSS或任何资产添加到您的站点。如此简单。
Put your css/js/images/etc folders in your root directory. In this way you can add css or any assets to your site. As simple as that.
<?php echo base_url("css/style.css"); ?>更新: 确保.htaccess文件允许访问这些文件夹。
UPDATE: Make sure .htaccess file allows access to these folders.
更多推荐
如何加载JS和CSS
发布评论