Methods to avoid repeated references in php-Linux general technology-Linux programming and kernel information. The following is a detailed description. As you know, in C, we can use # define to define a MACRO name and check whether the MACRO name is defined to determine whether the header file needs to be referenced. The same problem also exists in PHP. For example, A references B, C, and B to C. If no action is taken, C will be referenced twice. This may cause some strange problems.
I define a global variable and check whether the variable is defined to solve this problem. The solution is very simple, similar to C.
We recommend that you use the naming rules of ['user _ packages '] ['headfilename'] for this global variable. It may be better.
In addition, use require_once "headfiles. php" in the main program to avoid repeated references.
This method has been applied in our development team, and the effect is quite good. You may wish to do the same.
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