且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Codeigniter - 动态获取应用程序文件夹外的相对/绝对路径

更新时间:2022-06-11 21:32:38

在根目录中的 index.php 文件中,定义了最有用的路径,以便您可以在其余部分中使用它们代码.在这种情况下,您是否尝试过 FCPATH?

In the index.php file in the root, most useful paths are defined so that you can use them within the rest of the code. Have you tried FCPATH in this case?

FCPATH   -> '/'
BASEPATH -> '/system/'
APPPATH  -> '/application/'

更新:如评论中所述,上面的路径示例仅用于概述.为了提高项目的安全性,BASEPATHAPPPATH 不会在 FCPATH 内,而是在公共 www之外code>/root 目录.

UPDATE: As mentioned in the comments, the path examples above are only to give an overview. To increase the security of your project, BASEPATH and APPPATH wouldn't be inside FCPATH and instead outside of the public www/root directory.