thinkphp Multi-application/project configuration tips (using the same profile)--(16)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.