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

PHP
PHP 介绍
PHP 安装
PHP 语法
PHP 变量
PHP操作符
PHP If...Else
PHP Switch
PHP 数组
PHP 循环
PHP 函数
PHP 表单
PHP $_GET
PHP $_POST
PHP Date
PHP Include
PHP 文件处理
PHP 文件上传
PHP Cookies
PHP Sessions
PHP 发送邮件

PHP 中的 microtime() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 552 ::
收藏到网摘: 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

登陆 | 还没注册?