Get_cmd_var () and ini_get () Get the configuration value. What is the difference between get_cmd_var and ini_get?

Source: Internet
Author: User
Get_var_cfg (): The value is the value in the configuration file.
Ini_get (): The current value.

For example
Ini_set ('smtp ', '192. 160.0.24'); // change the current SMTP value.
Print get_cmd_var ('smtp '); // return localhost
Print ini_get ('smtp '); // return 192.160.0.24

Code

<? Php
/*
Our php. ini contains the following settings:

Display_errors = On
Register_globals = Off
Post_max_size = 8 M
*/
Echo 'display _ errors = '. ini_get ('display _ errors'). "\ n ";
Echo 'register _ globals = '. ini_get ('register _ globals'). "\ n ";
Echo 'Post _ max_size = '. ini_get ('Post _ max_size'). "\ n"; // post content submission restrictions:
Echo 'Post _ max_size + 1 = '. (ini_get ('Post _ max_size') + 1). "\ n ";
Echo 'Allow _ url_fopen = '. (ini_get ('Allow _ url_fopen'). "\ n"; // use the URL to open the file:
?>

 

This script will produce:

Display_errors = 1
Register_globals = 0 // nothing on my machine
Post_max_size = 8 M
Post_max_size + 1 = 9
Allow_url_fopen = 1

 

 

Code

<? Php
/*
Our php. ini contains the following settings:

Display_errors = On
Register_globals = Off
Post_max_size = 8 M
*/

Echo 'display _ errors = '. get_1__var ('display _ errors'). "\ n ";
Echo 'register _ globals = '. get_reg_var ('register _ globals'). "\ n ";
Echo 'Post _ max_size = '. get_cfg_var ('Post _ max_size'). "\ n"; // post content submission restrictions:
Echo 'Post _ max_size + 1 = '. (get_assist_var ('Post _ max_size') + 1). "\ n ";
Echo 'Allow _ url_fopen = '. (get_1__var ('Allow _ url_fopen'). "\ n"; // use the URL to open the file:

?>

 

 

Output

Display_errors = 1
Register_globals =
Post_max_size = 8 M
Post_max_size + 1 = 9
Allow_url_fopen = 1

 

 

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.