已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
PHP函数库分类三十10.PHP选项/信息函数列表2 getenv- Gets the value of an environment variablegetenv(PHP 4, PHP 5)getenvGets the value of an environment variable说明stringgetenv(string$varname)Gets the value of an environment variable.You can see a list of all the environmental variables by usingphpinfo(). Many of these variables are listed withinRFC 3875, specifically section 4.1, Request Meta-Variables.参数varnameThe variable name.返回值Returns the value of the environment variablevarname, orFALSEif the environment variablevarnamedoes not exist.范例Example #1getenv()Example getlastmod- Gets time of last page modificationgetlastmod(PHP 4, PHP 5)getlastmodGets time of last page modification说明intgetlastmod(void)Gets the time of the last modification of the current page.If youre interested in getting the last modification time of a different file, consider usingfilemtime().返回值Returns the time of the last modification of the current page. The value returned is a Unix timestamp, suitable for feeding todate(). ReturnsFALSEon error.范例Example #1getlastmod()example getmyinode- Gets the inode of the current scriptgetmyinode(PHP 4, PHP 5)getmyinodeGets the inode of the current script说明intgetmyinode(void)Gets the inode of the current script.返回值Returns the current scripts inode as an integer, orFALSEon error. getopt- Gets options from the command line argument listgetopt(PHP 4 = 4.3.0, PHP 5)getoptGets options from the command line argument list说明arraygetopt(string$options,array$longopts )Parses options passed to the script.参数optionsEach 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 stringxrecognizes an option-x.Only a-z, A-Z and 0-9 are allowed.longoptsAn 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 elementoptrecognizes an option-opt.Theoptionsparameter 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 leading white space or not.Note:Optional values do not accept (space) as a separator.Note:The format for theoptionsandlongoptsis almost the same, the only difference is thatlongoptstakes an array of options (where each element is the option) where asoptionstakes a string (where each character is the option).返回值This function will return an array of option / argument pairs orFALSEon failure.Note:The parsing of options will end at the first non-option found, anything that follows is discarded.更新日志版本说明5.3.0Added support for = as argument/value separator.5.3.0Added support for optional values (specified with :).5.3.0Parameterlongoptsis available on all systems.5.3.0This function is no longer system dependent, and now works on Windows, too.范例Example #1getopt()exampleRunning the above script withphp script.php -fvalue -hwill output:array(2) f= string(5) value h= bool(false)Example #2getopt()example#2Running the above script withphp script.php -f value for f -v -a -required value -optional=optional value -optionwill output:array(6) f= string(11) value for f v= bool(false) a= bool(false) required= string(5) value optional= string(14) optional value option= bool(false)Example #3getopt()example#3Passing multiple options as oneRunning the above script withphp script.php -aaacwill output:array(2) a= array(3) 0= bool(false) 1= bool(false) 2= bool(false) c= bool(false) getrusage- Gets the current resource usagesgetrusage(PHP 4, PHP 5)getrusageGets the current resource usages说明arraygetrusage(int$who= 0 )This is an interface togetrusage(2). It gets data returned from the system call.参数whoIfwhois 1, getrusage will be called withRUSAGE_CHILDREN.返回值Returns an associative array containing the data returned from the system call. All entries are accessible by using their documented field names.范例Example #1getrusage()example注释Note:此函数未在 Windows 平台下实现。 get_cfg_var- Gets the value of a PHP configuration optionget_cfg_var(PHP 4, PHP 5)get_cfg_varGets the value of a PHP configuration option说明stringget_cfg_var(string$option)Gets the value of a PHP configurationoption.This function will not return configuration information set when the PHP was compiled, or read from an Apache configuration 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.参数optionThe configuration option name.返回值Returns the current value of the PHP configuration variable specified byoption, orFALSEif an error occurs.更新日志版本说明5.3.0get_cfg_var()was fixed to be able to return array ini options. get_current_user- Gets the name of the owner of the current PHP scriptget_current_user(PHP 4, PHP 5)get_current_userGets the name of the owner of the current PHP script说明stringget_current_user(void)Returns the name of the owner of the current PHP script.返回值Returns the username as a string.范例Example #1get_current_user()example以上例程的输出类似于:Current script owner: SYSTEM get_defined_constants- Returns an associative array with the names of all the constants and their valuesget_defined_constants(PHP 4 = 4.1.0, PHP 5)get_defined_constantsReturns an associative array with the names of all the constants and their values说明arrayget_defined_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 thedefine() function.参数categorizeCausing this function to return a multi-dimensional array with categories in the 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 = 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 ( MY_CONSTANT = 1 )返回值更新日志版本说明5.3.1Wind
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 农行面试题目及答案
- 命题面试题目及答案
- 2025建筑工程设计咨询合同范本
- 面试题目及答案银行
- 2026届上海市长宁、嘉定区高二化学第一学期期末调研试题含答案
- 煤业财务面试题及答案
- 媒介行为面试题及答案
- 2025建筑材料供应合同
- 2026届辽宁省阜新市博大教育化学高二第一学期期中监测模拟试题含解析
- 2025关于正式员工合同范本
- 2025发展对象考试测试题库(附含答案)
- 合理用药培训试题及答案
- 粮食出口国地缘政治影响-洞察与解读
- 全国大学生职业规划大赛《数字媒体技术》专业生涯发展展示【高职(专科)】
- 2025年考研政治真题及答案解析
- 四氟储罐施工方案设计
- 生物质锅炉基础知识培训课件
- 市城区控制性详细规划编制服务方案投标文件(技术方案)
- 2025年版民间借款合同范本全文
- 子路背米孝双亲课件
- 加油站油料安全培训内容课件
评论
0/150
提交评论