Analysis of PHP configuration file php. ini

Source: Internet
Author: User
Today, let's talk about some interesting content in the PHP. ini file. The PHP. ini file is trusted by every PHP enthusiast. It is named PHP3.INI in the previous PHP version PHP3.0. Open it with NOTEPAD. files are usually used to control the Win of the system.

Today, let's talk about some interesting content in the PHP. ini file.

The PHP. ini file is trusted by every PHP enthusiast. It is named PHP3.INI in the previous PHP version PHP3.0. Open it with NOTEPAD. files are usually stored in the Windows directory of the operating system. As you can see, PHP. the INI file contains many semicolons (""), which are the same as those in Windows. these semicolons (;) are used to express annotations. that is to say, to make the configuration file easy to understand, developers will briefly clarify the efficiency of each configuration after the semicolon, these annotation lines are neglected during system processing. Of course, another benefit is that when the configuration of the PHP system is changed, we can add or remove annotations to some rows, which is simple and simple.
.

Auto_prepend_file string can specify a file to perform parsing before actively reading all PHP files. it can be considered any file such as PHP, ASP, and HTML (but the image file may not work ), it is very useful in special cases. For example, if you want to add an advertisement on each PHP page, and assume that you are developing a website and want all visitors to perform authentication before reading any PHP page, you can make your verification code a separate file, and set string to the file name here. Readers have asked: If I only need these functions for some files, what should I do? start your mind, for example:

Myprefix. php file
   If (strstr (strtoupper (PHP_SELF), '/PHPTEST /'))
Echo 'My ads!
';
?>

In this case, you only need to set auto_prepend_file = "myprefix. php", then all php files under the phptest directory will contain your ad header! It also needs to be clarified that this file should be placed in the path indicated by include_path. otherwise, errors may occur and will be mentioned below.

Auto_append_file string is similar to the above function, but it is automatically added to the end of the PHP file, and does not work when the PHP program exits with exit. With this function, we can easily add a footer to the company address!

Include_path string is used to search for files in the PATH defined by the include () and require () functions. Is it a bit like the set path command used in the DOS era? This parameter can provide a list of paths, but in UNIX, the paths are separated by colons. in NT, semicolon is used, and the direction of the slash is not the same. For example:
UNIX example: export de_path =.:/home/lib
NT example: include_path = '.: c: homeib'. "indicates the current directory.
Gpc_order string

GPC is the first letter of the GET/POST/COOKIE Variables. its order reflects the priority of the system to process the three variables. the priority increases sequentially from left to right. The default value is GPC. in this way, when two or three variables with the same name are passed to the server, the system will sort the variables by priority and only read the variables with higher priority. For example, if it is set to "GP", the cookie is neglected, and the GET is replaced by POST at the same time as the access method. Of course, in the programming process, we should try to avoid passing variables with the same name in different ways at the same time, otherwise the program's readability will deteriorate, in addition, different output results may occur in different systems.

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