将public_html上的文件夹放在共享主机环境中

在我的本地环境中,以下设置在我的index.php文件中工作:

$system_path = '../../ci/system/'; $application_folder = '../../ci/application'; 

我的文件夹结构如下所示:

 -ci ---system ---application -public_html ---site ----index.php 

这适用于我的本地环境,但是当我上传我的文件时,我收到一条错误消息:

 Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php 

我尝试了以下内容:

 $system_path = dirname(__FILE__).'../../ci/system/'; $application_folder = dirname(__FILE__).'../../ci/application'; 

我使用的网站是与hostgator和以下工作:

http://www.yoursitename.com/link.php ,放

 <?php symlink('/home/username/ci/system', '/home/username/public_html/system'); ?> <?php symlink('/home/username/ci/application', '/home/username/public_html/application'); ?> 

然后在浏览器中访问http://www.yoursitename.com/link.php 。 如果屏幕是空白的,它工作(符号链接被创build)

然后,在你的configuration文件(对我来说它是index.php),改变链接,就好像他们在public_html:

 $system_path = 'system'; $application_folder = 'application'; 

dirname( FILE )存在问题 – dirname没有结尾/返回,因此您必须添加它:

 include dirname(__FILE__) . '/../../smthng.php'; 

甚至更好:

 include __DIR__ . '/../../smthng.php';