如何访问应用程序文件夹中的资源? [英] How to access resources within application folder?
问题描述
首先,我完全意识到,存在一个更好的实现,将资源文件夹与应用程序(不在内部)。所以是的。
First of all, I am fully aware that a better implementation, putting resources folder alongside application (not inside), exists. So yeah.
Resources = js,css,images。
Resources = js, css, images.
这只是一个要求,想法如何?
This is just really a requirement, so any ideas how? I tried it but it says 403 (Forbidden).
推荐答案
这是可以使用的解决方案之一
This is one of the possible solutions you can use
/applications
/resources
.htaccess
.htaccess
.htaccess
的应用程序文件夹包含拒绝所有
.htaccess
of applications folder contains Deny from all
(它是CI默认值,这是您获得403 Forbidden的原因)
(it is CI default. which is the reason you get 403 Forbidden)
在 .htaccess
内部资源文件夹中保留允许所有
now make an .htaccess
inside resources folder and keep it Allow from all
(因此您只是可以访问resources文件夹)
(so you are just allowing the resources folder to be accessible)
这篇关于如何访问应用程序文件夹中的资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!