Original: thinkphp multi-application/project configuration tips (using the same profile)--(16)
thinkphp Multi-application configuration tips (no grouping is used, this is the home, Admin from the portal file)---- very practical!
For example: now has home, admin app
Problem: The front desk in the background to use the database, you have to configure their own config file
Requirements: Now want to home/aamin all use a common file configuration file, unified modification Good maintenance
Steps:
In the Project root folder (under the Portal File sibling directory), create a common config.php file
<?php
--Here's the configuration file before the background is directly introduced.
Return Array (
' Config item ' = ' config value '
' Db_prefix ' = ' tp_ ',//No table prefix left blank on line
' Db_dsn ' = ' mysql://root: @localhost: 3306/thinkphp ',
);
?>
Under the 2--e:\wamp\www\thinkphp\home\conf\config.php and admin
Change the original configuration file to $ARR2 and introduce the 1 public profile to return it.
<?php
this./is relative to the entry file's current
$arr =include './config.php ';
$arr 2=array (
' Config item ' = ' config value '
);
Return Array_merge ($arr, $arr 2);
?>
thinkphp Multi-application/project configuration tips (using the same profile)--(16)