用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3917|回复: 4
收起左侧

[已解决] codeigniter多项目共享的时候,导致Exceptions.php引入php_error.php报错

[复制链接]
发表于 2012-4-14 12:17:46 | 显示全部楼层 |阅读模式
环境:codeigniter2.0
因为项目有前后台,所以在根目录下新建admin文件夹,复制index.php放到admin目录下。编辑admin/index.php  
修改项目位置:
$system_path = '../system';
$application_folder = '../application/admin';

然后在application下新建admin文件夹,复制几个需要的文件夹到application/admin下

但是涉及到错误处理的时候,怎么会出现路径不对的情况。

Warning: CI_Exceptions::include(../application/admin/errors/error_php.php) [function.CI-Exceptions-include]: failed to open stream: No such file or directory in D:\Program Files\Apache\htdocs\furniture\system\core\Exceptions.php on line 182

Warning: CI_Exceptions::include() [function.include]: Failed opening '../application/admin/errors/error_php.php' for inclusion (include_path='.;C:\php5\pear') in D:\Program Files\Apache\htdocs\furniture\system\core\Exceptions.php on line 182

Warning: CI_Exceptions::include(../application/admin/errors/error_php.php) [function.CI-Exceptions-include]: failed to open stream: No such file or directory in D:\Program Files\Apache\htdocs\furniture\system\core\Exceptions.php on line 182

Warning: CI_Exceptions::include() [function.include]: Failed opening '../application/admin/errors/error_php.php' for inclusion (include_path='.;C:\php5\pear') in D:\Program Files\Apache\htdocs\furniture\system\core\Exceptions.php on line 182



这种情况该怎么处理,路径错了。
发表于 2012-4-15 18:56:43 | 显示全部楼层
$system_path = '../system';
$application_folder = '../application/admin';

请使用绝对路径
 楼主| 发表于 2012-4-15 21:34:39 | 显示全部楼层
Hex 发表于 2012-4-15 18:56
$system_path = '../system';
$application_folder = '../application/admin';

老大,我现在是在windows上面开发,
使用
$system_path = dirname(__FILE__).'../system';
$application_folder = dirname(__FILE__).'../application/admin';

运行提示错误:Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php

是不是我哪里弄错了。

绝对路径是使用http://localhost/proname/system  还是dirname(__FILE__).'../system';  
发表于 2012-4-16 11:46:14 | 显示全部楼层
core 发表于 2012-4-15 21:34
老大,我现在是在windows上面开发,
使用
$system_path = dirname(__FILE__).'../system';

何谓绝对路径?
这里指的路径是“文件系统路径”,即为类似 C:\abc\def 这样的路径。
所以绝对路径就应该类似 C:\abc\def 这样的路径。
发表于 2012-8-19 18:46:59 | 显示全部楼层
其实只是没有将 errors 文件夹复制进 admin 下

本版积分规则