How to do multi-site management in TP (multiple websites correspond to one backend), who has done it? Can you give me some ideas?
ᴬ ᴾᵀ
ᴬ ᴾᵀ 2018-04-18 17:27:22
0
2
1609

Develop multiple websites, and these websites should be managed by one backend. Can anyone tell me how to do it? Using tp to develop, can any master explain the idea

ᴬ ᴾᵀ
ᴬ ᴾᵀ

reply all(2)
dabour

Add a site id to distinguish different websites

苒苒

Give you two methods:

1. Each website corresponds to different entry files

Thought: In the tp framework, the entry files for the backend and the frontend are admin.php and index respectively. php, then according to this idea, if there are multiple websites, you can create a new entry file such as index2.php, corresponding to the directory of this website, such as: application/Innde2 directory, and then point the project directory to the root directory index2 when setting the domain name .php will do.

2. Use a unified entry file, determine the domain name in the entry file, that is, index.php, and jump to the corresponding directory according to the different domain names.

I don’t want to say too much about this, it’s very simple. I’ll just post the sample code for you:


// Define the application directory based on the domain name
$server = $_SERVER['SERVER_NAME' ];
if($server == '****.com'){
define('APP_PATH','./Mzhuisu/');
}else{
define(' APP_PATH','./Home/');
}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template