Code Analysis Learning for Discuz (ii) Home file

Source: Internet
Author: User

If the current address bar has a query character and is a number, the condition is set.
Query character: aaa=bbb is the query character
If the condition is established, the home is assigned to $_env[' Curapp ']; $_env can be understood as a hyper-global array similar to $_get. Here the $_env[' Curapp ' can be understood as the selected entry file.
and passes an array to $_get, the first member of the array specifies the controller name, and the second member formulates a parameter called UID, which is the user ID.

If the conditions here, 127 lines of the IF statement must be false, the following a large number of code is not executed, has jumped to 137 rows, directly loading the portal file.

If the first if statement is False

Cache_domain.php is a system-generated configuration file. The $domain array is declared in the cache_domain.php file.

If $_env[' domain ' is empty, set the currently selected app to Forum (forums), then skip to line 137.
If $_env[' domain ' is not empty

25: Split the current host domain name into an array by the. Number.

27: The acquired domain name is intercepted from the position of the first. For example,, after the cut,

28: If [' Domain '] [' app '] is not empty and is an array, and the domain name currently being accessed is also an item of its array value. The

30: Find the key for the current domain name in the app array as the selected app. For example, the currently accessed domain name is and found in the app array:

Then the value of $_env[' Curapp '] is home.

If the currently selected app is mobile (mobile), $_env[' Curapp ' is reset to forum

If the currently selected app is default or the currently selected app does not exist in the default app array, the currently selected app is assigned a null value.

37: This condition will be established after the root domain name is set and the root domain name is currently being accessed.

44: The conditions of this line do not know under what circumstances will be established. I did it several times. The list array is always empty. The following if statement is not executed, and it is not clear what the list array is for.

74: If the domain name that is currently accessed is a level two domain name, and this level two domain name is not reserved domain name, this condition will be established, the Checkholdmain function is used to check whether it is a reserved domain name.

75: Get the domain name prefix
76: Get root domain Name
77: Load Frame Entry file

This string of code can be seen as an initialization operation. These are the properties of the Discuz_application class.

85: This line of code will query the database through the Table_common_domain class to find the application type of the root domain binding. Fetch_by_domain_domainroot

If the app type is home, how about if the app type is group.

General analysis

Code Analysis Learning for Discuz (ii) Home file

Related Article

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: 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.