PHP Configuration File Application Example

Source: Internet
Author: User
Tags php database
    1. if (Strstr (Strtoupper (php_self), \ "/phptest/\"))
    2. echo \ "My ad!"
      \";
    3. ?>
Copy Code

So as long as the settings: auto_prepend_file= "myprefix.php", then all the phptest directory of PHP files are included in your advertising head! It is also necessary to note that this file should be placed in the path referred to by include_path, otherwise it may be wrong, and it will be mentioned below.

The Auto_append_file string is similar to the above, but is automatically added to the end of the PHP file, and the PHP program exits with exit (). With this feature, we can easily add a footnote to the company's address!

Include_path string The function of this parameter is to let the include (), require () and other functions in the path defined here to find files, is it a bit like the DOS era used in the set path command? This parameter can provide a list of paths, but in Unix the paths are separated by colons, semicolons are used in NT, and the direction of the slashes is not the same. Example: Unix: include_path=.:/ HOME/LIBNT Example: include_path=\ ".: C:\home\lib\" where "." Represents the current directory. Gpc_order string

GPC is the first letter of the Get/post/cookie three variables, the order of which reflects the system to deal with the priority level of three variables, from left to right, priority increments. The default setting is GPC, so that when any two or three names of the same variables are passed to the server, the system will sort by priority and read only those variables with higher precedence. Another example is set to "GP" to ignore the cookie, and in the same way as the access method, the POST instead of get. Of course, we should try to avoid passing the same name variables in different ways during the programming process, otherwise the readability of the program will be bad, and there may be different output results in the configuration of different systems.

MAGIC_QUOTES_GPC Boolean This parameter determines the special characters contained in the three variables of the Get/post/cookie: single, Double, Slash, and escape character backslash (the "\" used in C language)? Because in the PHP database and other systems, single quotes and other characters usually have special meaning, in order to distinguish with the real character, we can set magic_quotes_gpc=on, so that if we get from the user side of the variable in a single quote, will be preceded by the escape character, Then we can use the function stripslashes (string str) as needed, which removes the backslash escape character "\" in the string. If you have two consecutive backslashes, remove one and leave one. If there is only one backslash, remove it directly. ) to remove the escape character "\".

Compare:

    1. echo A;
    2. ?>
Copy Code

In the case of Magic_quotes_gpc=on and off, enter single quotation marks, double quotes in the text box, and then submit to see what the difference is?

SMTP string Specifies the domain name or IP address of the mail sending server, so that we can send a letter, compared to the Microsoft ASP, PHP This feature is much simpler and more convenient, someone to ask, if I do not have a mail server to do? It's simple, just fill in the local ISP's mail server. In fact, sending and receiving mail server is like our real life post office, in which post Office can send letters, and receive the letter is in the fixed post office.

    1. error_prepend_string = \ "\"
    2. error_append_string = \ "\"
Copy Code

These two settings are more interesting, as set above, you can see: The program is wrong! Because its function is to set the error message into a conspicuous red color.

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