Summary of some php information functions for you, Summary of php information functions _ PHP Tutorial

Source: Internet
Author: User
Tags php software
Summarize some php information functions and php information functions for you. For you to summarize some php information functions, and summarize some function concepts contained in php information functions as follows. Applicable version of the PHP information function getenv: PHP3 and PHP4 functions: summarize some php information functions and summarize the php information functions.

Some functions of PHP information functions are summarized as follows.

Getenv of PHP information functions

Applicable versions: PHP3 and PHP4
Function: obtains the value of an environmental variable.
Function syntax: string getenv (string varname)
Function description: This function returns the environmental variable value of PHP. you can use this function to obtain relevant data.
Sample program:

<? PHP $ ip = getenv ("REMOTE_ADDR"); echo "client IP:". $ IP;?>

Execution result:The results vary with users.

Get_current_user of the PHP information function

Applicable versions: PHP3 and PHP4
Function: get the name of the PHP code owner.
Function syntax: string get_current_user (void)
Function description: obtains the name of the PHP code owner currently in use.
Sample program:

< ?PHP echo get_current_user(); ?>

Execution result:The results vary with users.

Getlastmod of PHP information functions

Applicable versions: PHP3 and PHP4
Function: obtain the last update time of the webpage.
Function syntax: int getlastmod (void)
Function description: gets the last time the webpage content is updated on the currently used webpage.
Sample program:

<? PHP echo "last page update time:". date ("F d y h: I: s, getlastmod ();?>

Execution result:Last webpage update time: January 31 2015 19:51:30

Getrusage of PHP information functions

Applicable versions: PHP3 and PHP4
Function: obtains the usage of system resources.
Function syntax: array getrusage (int [who])
Function description: obtains the current system resource usage status and returns the result in an array. for details about the parameters, see the system operation manual getrusage (2 ).
Sample program:

< ?php $dat=getrusage(); echo $dat["ru_nswap"];#number of swaps echo $dag["ru_majflt"]; #number of page faults echo $dat["ru_utime.tv_sec"];#user time used (seconds) echo $dat["ru_utime.tv_usec"]; #user time used (microseconds) ?> 

Execution result:Different results are displayed based on different user conditions.

Phpinfo of PHP information functions

Applicable versions: PHP3 and PHP4
Function: displays all related information in the PHP System.
Function syntax: int phpinfo ([int what])
Function description: displays a large amount of information about the current PHP status, including PHP options, extended functions, versions, server information, module environment, environment parameters, operating system versions, paths... . The output result can be changed by specifying one or more of the following settings. If no parameter is specified, all information is displayed.
Sample program:

< ?php echo phpinfo(INFO_GENERAL); ?> 

Execution result:

PHP Version 4.0.3 System Windows 95/98 4.10 Build Date Oct 12 2000 Server api cgi Virtual Directory Support enabled Configuration File (php. ini) Path php. ini ZEND_DEBUG disabled Thread Safety Enabled This program makes use of the Zend scripting language engine: Zend Engine v1.0.3, copyright (c) 1998-2000 zend Technologies

Command: phpversion ()

Phpversion of PHP information functions

Applicable version: PHP3 and PHP4 functions: obtain the version information of the PHP System.
Function syntax: string phpversion (void)
Function description: returns the PHP interpreter version in progress as a string.
Sample program:

<? Php echo "PHP" software version: ". phpversion ();?>

Execution result:PHP software version: 4.0.3 reference command: phpinfo ()

Set_time_limit of PHP information functions

Applicable versions: PHP> = 4.0.4, PHP4
Function: limits the maximum execution time.
Function syntax: void set_time_limit (int seconds)
Function description: limits the number of seconds that the PHP program can execute. if the execution time of the program reaches the set number of seconds, a fatal error message is generated and the execution of the program is interrupted.

The preset time limit is 30 seconds. the execution time calculation method is: when the program is read and executed, the calculation starts. Therefore, if the execution time is set to 20 seconds, however, it takes 25 seconds to load and execute the website. In total, it takes 45 seconds for the webpage to be interrupted. If the time is set to 0, there is no time limit.

The above are all the php time functions compiled by Xiaobian. I hope they will help you in your learning.

Some function concepts contained in PHP information functions are summarized as follows. Applicable version of the PHP information function getenv: PHP3 and PHP4 functions :...

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.