更新时间:2022-11-04 20:28:46
这是不推荐,您在应用程序文件夹中有css或图像
在主目录中创建资产文件夹
应用程序
assets
资产> css
assets>图片
assets> js
system
index.php
在视图上使用示例<?php echo base_url('assets / css / stylesheet.css');?>
。
I am creating a web page and trying to access a stylesheet which is inside a "application/css/" folder. So how we can access this file and what helper function should use? Below is the head section I used in php file.
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Home</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
If I use base_url('css/style.css') or link_tag('css/style.css'), it is returning url like 'http://localhost/test/css/style.css' which does not return path of css file.'http://localhost/test' is the base url.
It is Not Recommended that you have css or images in applications folder
Create a assets folder in main directory
application
assets
assets > css
assets > images
assets > js
system
index.php
On view use example <?php echo base_url('assets/css/stylesheet.css');?>
Autoload the url helper also.