管理多個應(yīng)用?
默認(rèn)情況下,我們假設(shè)你只是用CodeIgniter來管理一個應(yīng)用,并將該應(yīng)用在 application 目錄下進(jìn)行構(gòu)建。 然而也存在這樣的可能性:多個應(yīng)用共享一個CodeIgniter的安裝目錄,甚至開發(fā)者會將 application目錄進(jìn)行重命名或移動位置。
重命名或遷移應(yīng)用程序目錄?
如果你想重命名你的應(yīng)用文件夾或者移動
it to a different location on your server, other than your project root, open
your main app/Config/Paths.php and set a full server path in the
$appDirectory variable (at about line 38):
public $appDirectory = '/path/to/your/application';
You will need to modify two additional files in your project root, so that
they can find the Paths configuration file:
/sparkruns command line apps; the path is specified on or about line 36:require 'app/Config/Paths.php'; // ^^^ Change this if you move your application folder
/public/index.phpis the front controller for your webapp; the config path is specified on or about line 16:$pathsPath = FCPATH . '../app/Config/Paths.php'; // ^^^ Change this if you move your application folder
單個CodeIgniter對應(yīng)運(yùn)行多個應(yīng)用?
如果你想要讓多個不同的應(yīng)用來共享一次CodeIgniter的安裝文件,只需要將你的應(yīng)用目錄下的所有目錄都移動到他們對應(yīng)的子目錄中即可。
舉例而言,加入你想要創(chuàng)建兩個應(yīng)用程序,命名為”foo”和”bar”,你可以將你的應(yīng)用目錄排列如下:
/foo
/app
/public
/tests
/writable
/bar
/app
/public
/tests
/writable
/codeigniter
/system
/docs
This would have two apps, “foo” and “bar”, both having standard application directories
and a public folder, and sharing a common codeigniter framework.
The index.php inside each application would refer to its own configuration,
../app/Config/Paths.php, and the $systemDirectory variable inside each
of those would be set to refer to the shared common “system” folder.
If either of the applications had a command-line component, then you would also
modify spark inside each application’s project folder, as directed above.