Usage of the PHP configuration function ini_get () _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
The usage of the PHP configuration function ini_get () is described in detail. Output: display_errors1register_globals0post_max_size8Mpost_max_size + 19PHP configuration function ini_get () is mainly used to obtain the configuration file, which can facilitate many operations. RatioOutput:

  1. Display_errors = 1
  2. Register_globals = 0
  3. Post_max_size = 8 M
  4. Post_max_size + 1 = 9

The PHP configuration function ini_get () is mainly used to obtain the configuration file, which facilitates many operations. For example, if you want to filter strings, but do not know whether magic_quotes_gpc is enabled, you can write a function like this:

 
  1. /* String filter function */
  2. Function stringFilter ($ str)
  3. {
  4. If (ini_get ('Magic _ quotes_gpc )')
  5. {
  6. Return $ str;
  7. }
  8. Else {
  9. Return addslashes ($ str );
  10. }
  11. }

Of course, if you cannot know whether your global variables are enabled, you can also customize the following functions:

 
  1. /* Variable detection function */
  2. Function getGetVar ($ var)
  3. {
  4. If (ini_set ('register _ gobals '))
  5. {
  6. Return $ var;
  7. }
  8. Else {
  9. Return $ _ GET ['var'];
  10. }
  11. }

Of course, you can use the PHP configuration function ini_get () for many purposes.


Export display_errors = 1 register_globals = 0 post_max_size = 8 M post_max_size + 1 = 9 PHP configuration function ini_get () is mainly used to obtain the configuration file, which can facilitate many operations. Than...

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.