codeigniter 包含 css 或 js 文件

标签 codeigniter

如果 View 位于应用程序文件夹内,为什么我无法包含 View 中的任何内容?

当我包含在主目录中时就可以了:

这有效:

<link rel="stylesheet" type="text/css" href="{ci_base_url}css/site.css" /> 

但这不起作用:

<link rel="stylesheet" type="text/css" href="{ci_base_url}application/css/site.css" />

为什么?

提前致谢

最佳答案

只有您所谓的“主目录”中的内容可以通过 http 请求直接访问。这是出于安全原因。通常该目录被命名为“public”

关于codeigniter 包含 css 或 js 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5961287/

相关文章:

php - 将 codeigniter 站点集成为 wordpress 插件

php - Codeigniter 3 - 从外部 Codeigniter 安装访问 session

php - 使用 codeigniter 将文本字段与行中的主键关联

php - Codeigniter - 使用 edit_unique 编辑表单(重新填充)

php - 我需要将数据库中的数据显示到下拉模式 CodeIgniter

CodeIgniter 上传和调整大小问题

php - Codeigniter:将命名空间添加到 Controller 类时出现服务器错误

php - MySQL 查询根据两个不同表中的值选择一个表。

javascript - 如何从 jquery 调用 Controller ?

PHP CodeIgniter 4 - 表单提交 - 错误 "Can' t 找到 'registrations/index' 的路由“