《PHP函数库分类三十.doc.pdf》由会员分享,可在线阅读,更多相关《PHP函数库分类三十.doc.pdf(12页珍藏版)》请在三一文库上搜索。
1、PHP函数库分类三十 10. PHP选项/ 信息函数列表2 ? getenv ? Gets the value of an environment variable getenv (PHP 4, PHP 5) getenv 一Gets the value of an environment variable 说明 string getenv ( string $vamame ) Gets the value of an environment variable. You can see a list of all the environmental variables by using php
2、info(). Many of these variables are listed within ? RFC 3875, specifically section 4.1, Request Meta- Variables”. 参数 varname The variable name. 返回值 Returns the value of the environment variable vamame, or FALSE if the environment variable varname does not exist. 范例 Example #1 getenv() Example ?getla
3、stmod - Gets time of last page modification getlastmod (PHP 4, PHP 5) getlastmod Gets time of last page modification 说明 int getlastmod ( void ) Gets the time of the last modification of the current page. If you*re interested in getting the last modification time of a different file, consider using f
4、ilemtime()? 返回值 Returns the time of the last modification of the current page. The value returned is a Unix timestamp, suitable for feeding to date() ? Returns FALSE on error. 范例 Example #1 getlastmod() example ?getmyinode ? Gets the inode of the current script getmyinode (PHP 4, PHP 5) getmyinode 一
5、Gets the inode of the current script 说明 int getmyinode ( void ) Gets the inode of the current script? 返回值 Returns the current scripfs inode as an integer, or FALSE on error ? ? getopt ? Gets optio ns from the comma nd line argume nt list getopt (PHP 4 = 4.3.0, PHP 5) getopt 一Gets options from the co
6、mmand line argument list 说明 array getopt ( string options , array $Longopts ) Parses options passed to the script. 参数 options Each character in this string will be used as option characters and matched against options passed to the script starting with a single hyphen (-). For example, an option str
7、ing recognizes an option -x. Only a-z, A-Z and 0-9 are allowed. Longopts An array of options. Each element in this array will be used as option strings and matched against options passed to the script starting with two hyphens (). For example, an longopts element n opt n recognizes an optionop The o
8、ptions parameter may contain the following elements: ?Individual characters (do not accept values) ?Characters followed by a colon (parameter requires value) ?Characters followed by two colons (optional value) Option values are the first argument after the string. It does not matter if a value has l
9、eading white space or not. Note: Optional values do not accept “ “(space) as a separator. Note: The format for the options and Longopts is almost the same, the only difference is that Longopts takes an array of options (where each element is the option) where as options takes a string (where each ch
10、aracter is the option). 返回值 This function will return an array of option / argument pairs or FALSE on failure? Note: The parsing of options will end at the first non-option found, anything that follows is discarded. 更新日志 版本说明 5 3 c ? ? Added support for , = H as argument/value separator. Added suppo
11、rt for optional values (specified with 版本说明 5.3. 0 Parameter Longopts is available on all systems. 5.3. 0This function is no longer system dependent, and now works on Windows, too. 范例 Example #1 getopt() example Running the above script with php script.php -fvalue ?h will output: array(2) , f , = st
12、ring(5) “value“ , h , = bool(false) Example #2 getopt() example#2 “f:/ Required value “v:/ Optional value nabcH ; / These options do not accept values $longopts = array( / Required value / Optional value / No value / No value ); $options = getopt($shortoptsJ $longopts); var_dump($options); ? bool(fa
13、lse) , a, = bool(false) nrequired“= string(5) “value“ “optional“= str in g(14) “opti onal value* “option n= bool(false) Example #3 getopt() example#3 Passing multiple options as one Running the above script with php script.php -aaac will output: array(2) , a,= array(3) 0= bool(false) 1= bool(false)
14、2 = bool(false) H c n= bool(false) ? getrusage - Gets the current resource usages getrusage (PHP 4, PHP 5) getrusage 一Gets the current resource usages 说明 array getrusage ( int $who = 0 ) This is an interface to getrusage(2). It gets data returned from the system call. 参数 who If who is 1, getrusage w
15、ill be called with RUSAGE_CHILDREN.返回 值 Returns an associative array containing the data returned from the system call? All entries are accessible by using their documented field names. 范例 Example #1 getrusage() example 注释 Note:此函数未在Windows平台下实现。 ? get_cfg_var ? Gets the value of a PHP configuration
16、 option get_cfg_var (PHP 4, PHP 5) get_cfg_var Gets the value of a PHP configuration option 说明 string get_cfg_var ( string $option ) Gets the value of a PHP configuration option. This function will not return configuration information set when the PHP was compiled, or read from an Apache configurati
17、on file? To check whether the system is using a configuration file, try retrieving the value of the cfg_file_path configuration setting? If this is available, a configuration file is being used. 参数 option The con figuration option name. 返回值 Returns the current value of the PHP configuration variable
18、 specified by option, or FALSE if an error occurs. / / / / number of number of user time user time swaps page fauIts used (seconds) used (microseconds) 更新日志 版本说明 5.3. get_cfg_var() was fixed to be able to return “array“ ini 0 optio ns. ? get_cur rent_user - Gets the name of the owner of the current
19、PHP script get_current_user (PHP 4, PHP 5) get_current_user Gets the name of the owner of the current PHP script 说明 string get_current_user ( void ) Returns the name of the owner of the current PHP script. 返回值 Returns the username as a string. 范例 Example #1 get_current_user() example 以上例程的输出类似于: Cur
20、rent script owner: SYSTEM ? get_defined_constants ? Returns an associative array with the names of all the constants and their values get_defined_constants (PHP 4 = 4.1.0, PHP 5) get_defined_constants Returns an associative array with the names of all the constants and their values 说明 array get_defi
21、ned_constants ( bool $categorize = false ) Returns the names and values of all the constants currently defined ? This includes those created by extensions as well as those created with the define() function. 参数 categorize Causing this function to return a multi-dimensional array with categories in t
22、he keys of the first dimension and constants and their values in the second dimension. 以上例程的输出类似于: -Array :( ; Core = Array : ( : E_ERROR = 1 : E_WARNING = 2 E_PARSE = 4 E_NOTICE = 8 E_CORE_ERROR = 16 E_CORE_WARNING = 32 E_COMPILE_ERROR = 64 E_COMPILE_WARNING = 128 E_USER_ERROR = 256 E_USER_WARNING
23、= 512 E_USER_NOTICE = 1024 E_ALL = 2047 TRUE = 1 ) pcre = Array ( PREG_PATTERN_ORDER = 1 PREG_SET_ORDER = 2 PREG_OFFSET_CAPTURE = 256 PREG_SPLIT_NO_EMPTY = 1 PREG_SPLIT_DELIM_CAPTURE = 2 PREG_SPLIT_OFFSET_CAPTURE = 4 PREG_GREP_INVERT = 1 ) user = Array ( MYJZONSTANT = 1 ) Windows only: Core constant
24、s are categorized under Core, previously mhash. :) 返回值更 新日志 版本说明 版本说明 5.3.0 Core constants are categorized under Core, previously internal. On Windows, the Core Constants are categorized under mhash. 5.2.1 1 The categorize parameter now operates appropriately. Previously, the categorize parameter wa
25、s interpreted as !is_null($categorize), making any value other than NULL force the constants to be categorized. 5.0.0The categorize parameter was added. 范例 Example #1 get_defined_constants() Example 以上例程的输出类似于 : Array :( I : E_ERROR = 1 : E_WARNING = 2 : E_PARSE = 4 I : E_NOTICE = 8 : E_CORE_ERROR = 16 : E_CORE_WARNING = 32 a : E_COMPILE_ERROR = 64 : E_COMPILE_WARNING = 128 : E_USER_ERROR = 256 : E_USER_WARNING = 512 : E_USER_NOTICE = 1024 : E_ALL = 2047 : TRUE = 1
链接地址:https://www.31doc.com/p-5616296.html