Summarize some PHP information functions for you_PHP tutorial

WBOY
Release: 2016-07-15 13:35:16
Original
4316 people have browsed it

PHP information function getenv

□ Applicable versions: PHP3, PHP4
□ Function function: Get Environment variable value.
□ Function syntax: string getenv (string varname)
□ Function description: This function can return the value of PHP's environment variable. You can use this function to obtain relevant data.
□ Sample program:

  1. < ?PHP ( "REMOTE_ADDR");
  2. echo "The client's IP is: ".$IP; ?>
  3. □ Execution results: This result varies from user to user. □ Reference command: None
  4. PHP information function get_current_user□ Applicable versions: PHP3, PHP4□ Function: Get this PHP program code Owner's name. □ Function syntax: string get_current_user (void)□ Function description: Get the name of the owner of the PHP program code currently in use. □ Sample program:


<

?PHP



echo get_current_user();
  1. ?>

  2. □ Execution results: This result varies from user to user. □ Reference command: None
  3. PHP information function getlastmod □ Applicable versions: PHP3, PHP4□ Function: Get the last update of this web page time. □ Function syntax: int getlastmod (void)□ Function description: Get the time when the web page content was last updated on the web page currently in use. □ Sample program:
  4. □ Execution result: Web page last updated: January 31 2001 19:51:30

    □ Reference command: None

    PHP information function getrusage

    □ Applicable versions: PHP3, PHP4

    □ Function: Get system resource usage status.
    □ Function syntax: array getrusage (int [who])
    □ Function description: Get the current system resource usage status and return it in the form of an array. For related parameters, please refer to the system operation manual getrusage(2).
    □ Sample program:

    <ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?PHP  </span></span></li><li><span>echo "网页最后更新时间:".date <br />("F d Y H:i:s,getlastmod());  </span></li><li class="alt"><span class="tag">?></span><span> </span></span></li></ol>
    Copy after login
    □ Execution results: Different results will appear depending on the user's situation

    □ Reference command: None

    PHP information function phpinfo

    □ Applicable versions: PHP3, PHP4

    □ Function: display all relevant information in the PHP system
    □ Function syntax: int phpinfo ([int what])
    □ Function description: Display a large amount of information about the current PHP status, including PHP options, extended functions, version, server information, module environment, environment parameters, operating system version, path... and other information. The output results can be changed by specifying one or more of the following settings. If no parameters are filled in at all, all information will be displayed.

    INFO_GENERAL

    INFO_CREDITS
    <ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?php  </span></span></li><li><span>$</span><span class="attribute">dat</span><span>=</span><span class="attribute-value">getrusage</span><span>();  </span></li><li class="alt"><span>echo $dat["ru_nswap"];#number of swaps  </span></li><li><span>echo $dag["ru_majflt"]; #number of page  </span></li><li class="alt"><span>faults  </span></li><li><span>echo $dat["ru_utime.tv_sec"];#user time  </span></li><li class="alt"><span>used (seconds)  </span></li><li><span>echo $dat["ru_utime.tv_usec"]; #user time  </span></li><li class="alt"><span>used (microseconds)  </span></li><li><span class="tag">?></span><span> </span></span></li></ol>
    Copy after login
    INFO_CONFIGURATION

    INFO_MODULES
    INFO_ENVIRONMENT

    INFO_VARIABLES

    INFO_LICENSEINFO_ALL□ Sample program:


    □ 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

    □ Reference command: phpversion( )


    PHP information function phpversion

    <ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?php  </span></span></li><li><span>echo phpinfo(INFO_GENERAL);  </span></li><li class="alt"><span class="tag">?></span><span> </span></span></li></ol>
    Copy after login
    □ Applicable versions: PHP3, PHP4

    □ Function: Get the version information of the PHP system.

    □ Function syntax: string phpversion (void)

    □ Function description: Return the executing PHP interpreter version as a string.
    □ Sample program:


    □ Execution result: PHP software version: 4.0.3

    □ Reference command: phpinfo()

    PHP information function set_time_limit

    □ Applicable versions: PHP>=4.0.4, PHP4

    □ Function: Limit the maximum execution time.
    □ Function syntax: void set_time_limit (int seconds)
    □ Function description: Limit the number of seconds that this PHP program can be executed. If the execution time of the program reaches the set number of seconds, a fatal error will be generated. information, and interrupt program execution.

    The default time limit is 30 seconds. The execution time calculation method is: the calculation starts when the program is read and executed. Therefore, if the set time is 20 seconds, but it takes 25 seconds to load and execute, It took a total of 45 seconds for the web page to be interrupted. If the time is set to 0, it means there is no time limit.


    www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445937.htmlTechArticlePHP information function getenv □ Applicable versions: PHP3, PHP4 □ Function: Get the value of the environment variable. □ Function syntax: string getenv (string varname) □ Function description: This function...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!