当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > microtime() 函数

PHP
PHP Libxml
PHP Math
PHP Misc
PHP MySQL
PHP SimpleXML
PHP String
PHP XML
PHP Zip
PHP Mail
用PHP5的DirectoryIterators递归扫描目录
PHP 阻止SQL注入式攻击
PHP5面向对象 - 基础 - 类和对象
PHP5面向对象 - 基础 - 类的属性( public )
PHP5面向对象 - 基础 - 类的属性( private )
PHP5面向对象 - 基础 - 方法
PHP5面向对象 - 基础 - 对象的比较
php5面向对象 - 基础 - 构造函数
php5面向对象 - 基础 - 析构函数
用PHP控制用户的浏览器 - ob*函数的使用
PHP PDO 学习笔记

PHP 中的 microtime() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 555 ::
收藏到网摘: n/a

Definition and Usage
定一个用法

The microtime() function returns the current Unix timestamp with microseconds.
microtime()函数的作用是:返回当前Unix时间戳和微秒数(百万分之一秒)。

Syntax
语法

microtime(get_as_float)

Parameter参数 Description描述
get_as_float Optional. When set to true it specifies that the function should return a float, instead of a string
可选参数。如果该参数设置为True,则该函数以浮点数字的形式返回值,否则以字符串形式返回值


Tips and Notes
注意

Note: This function returns the string "microsec sec", where sec is the number of seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and microsec is the microseconds part. Notice that both parts are returned in units of seconds.
注意点:这个函数返回字符串“microsec sec”,sec是指Unix Epoch(1970年1月1日0:00:00)开始计算所经过的秒数,microsec只是表示其微秒的部分。上述二者都将以“秒”为单位返回。

Note: The get_as_float parameter was added to PHP 5!
注意点:get_as_float仅在PHP 5以上版本中支持。


Example
案例

<?php
echo(microtime());
?>

The output of the code above could be:
上述代码将输出下面的结果:

0.25139300 1138197510

评论 (0) All

登陆 | 还没注册?