为什么CodeIgniter应用程序文件在public_html文件夹中? [英] Why are CodeIgniter application files in the public_html folder?

查看:235
本文介绍了为什么CodeIgniter应用程序文件在public_html文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

公开视图中的所有文件是否都是坏事?

Isn't having all of the files in public view a bad thing?

当然,诸如/system/application/config/database.php之类的内容不应该公开可见!

Surely things such as /system/application/config/database.php should not be publicly visible!

推荐答案

CodeIgniter开发人员EllisLabs已经以这种方式设置了框架,这意味着,希望尝试框架的人不必干扰他们服务器上的任何权限设置。

The developers of CodeIgniter, EllisLabs, have set up the framework in this way for ease of use. It means that people wishing to try out the framework don't have to fiddle with any permissions settings on their server.

当然,在生产服务器上,你是绝对正确的,将您的PHP文件放在公共HTML文件夹中不是一个好主意。

Of course on a production server, you are absolutely right, putting your PHP files in the public HTML folder is not a good idea.

组织文件夹的更好方法是:

A better way to organise your folders would be:


  • root


    • code_igniter


      • application_folder


        • config

        • controllers

        • b $ b
        • ...


        • css

        • js


        • index.php
          .htaccess

        这里唯一要做的其他更改是将index.php的第26行改为:

        The only other change to be made here would be to change line 26 of index.php to read:

        $system_folder = "../../code_igniter/system-folder";
        

        这篇关于为什么CodeIgniter应用程序文件在public_html文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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