定义根路径 [英] Defining a Root Path
本文介绍了定义根路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种方法来将配置变量定义为网站的根路径。定义它的最好方法是什么。我正在使用Codeigniter。
I'm looking for a way to define a config variable as being the root path of my website. What's the nicest way to define this. I am using Codeigniter.
$config['root_path'] = ?
这是我的config文件夹中的site_config文件。
This is for my site_config file in my config folder.
/
/dev
/dev/application
/dev/application
/dev/application/config
/dev/application/config/site_config.php
/dev/system/
/dev/assets/
/public_html
推荐答案
我认为
$config['root_path'] = $_SERVER['DOCUMENT_ROOT'];
将为您提供所需的内容,而不管哪个脚本从何处调用它。
will give you what you're looking for, regardless of which script calls it from where.
另一方面,我对Codeigniter的使用经验大约为零,这可能会对我的建议产生负面影响。
On the other hand, I have approximately zero experience with codeigniter, which could negatively impact the efficacy of my suggestion.
这篇关于定义根路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文