Home Backend Development PHP Tutorial Summarize some PHP information functions for you_PHP tutorial

Summarize some PHP information functions for you_PHP tutorial

Jul 15, 2016 pm 01:35 PM
php information function Function Summarize Version Be applicable

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

CakePHP Working with Database CakePHP Working with Database Sep 10, 2024 pm 05:25 PM

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles