我必须在CodeIgniter(CI)中创建具有多个客户端的相同核心文件的应用程序。 每个客户端在他自己的文件夹(使用子域)中运行应用程序,他的index.php文件在哪里。在该index.php中包含该用户数据库的配置(每个用户都有自己的数据库)。 我试图将所有的fiels和应用程序从CI封装到一个额外的类中,然后在每个子域的每个文件夹中创建该类的实例。但那并不奏效。从相同的CodeIgniter文件运行多个客户端
然后我试图从每个客户端子目录中的CI文件夹中调用main index.php。这里是文件结构的图像: http://img208.imageshack.us/img208/8596/shx8.png
的index.php在每个子域文件夹是这样的:
include "../../../application/engine.php";
$app = new Engine();
$app->start();
然后当我运行该客户端的index.php我得到这个:
Your system folder path does not appear to be set correctly. Please open the
following file and correct this: index.php
,我没有改变CI的index.php文件夹路径:
$system_path = '../../../application/engine/system';
$application_folder = '../../../application/engine/application';
然后我收到以下错误:
Fatal error: Call to a member function item() on a non-object in C:\wamp\www\projectX\application\engine\system\core\Utf8.php on line 47
正如你看到的,我在系统\核心文件出现错误,而且我相信我不应该对其进行编辑。
Utf8.php线47:
AND $CFG->item('charset') == 'UTF-8'
这$ CFG被定义为:
global $CFG;
即使我评论这行,我得到了其他的文件下一个错误。
Fatal error: Call to a member function elapsed_time() on a non-object in C:\wamp\www\projectX\application\engine\system\core\Output.php on line 360
Output.php行360:
$elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
有没有办法解决这个问题,并完成这种方式,或者我应该有文件和文件夹的不同的组织?那么怎么做呢?
这是很容易来运行一个系统文件夹和应用程序文件夹多多个应用程序。请访问http://ellislab.com/codeigniter/user-guide/general/managing_apps.html另外,我还使用www.thephpcode.com上的相同原则为用户预览生成的网站。 – Nishanthan
我知道,但每个客户端的每个应用程序文件夹都是一样的。那么拥有10-15个文件夹的文件有什么意义? – lolrs2013