位置: 编程技术 - 正文
推荐整理分享PHP:uniqid()的用法_misc函数(phpunicode),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:php的unset函数,php中ul,php uniqid(),php use 用法,php uniqid(),phpunit,phpunit,phpunit,内容如对您有帮助,希望把文章链接给更多的朋友!
(PHP 4, PHP 5)
uniqid — 生成一个唯一ID
说明 string uniqid ([ string $prefix = "" [, bool $more_entropy = false ]] )获取一个带前缀、基于当前时间微秒数的唯一ID。
参数prefix
有用的参数。例如:如果在多台主机上可能在同一微秒生成唯一ID。
prefix为空,则返回的字符串长度为。more_entropy 为 TRUE,则返回的字符串长度为。
more_entropy如果设置为 TRUE,uniqid() 会在返回的字符串结尾增加额外的煽(使用combined linear congruential generator)。 使得唯一ID更具唯一性。
返回值返回字符串形式的唯一ID。
范例
Example #1 uniqid() 例子
<?php/*Auniqid,like:4bfea6*/printf("uniqid():%srn",uniqid());/*Wecanalsoprefixtheuniqid,thisthesameas*doing:**$uniqid=$prefix.uniqid();*$uniqid=uniqid($prefix);*/printf("uniqid('php_'):%srn",uniqid('php_'));/*Wecanalsoactivatethemore_entropyparameter,whichis*requiredonsomesystems,likeCygwin.Thismakesuniqid()*produceavaluelike:4b.*/printf("uniqid('',true):%srn",uniqid('',true));?> 更新日志版本 说明 5.0.0 prefix 参数设为可选。 4.3.1 prefix 参数的长度限制提升到个字符。
注释Note:
在Cygwin环境下,为了使此函数能够工作,more_entropy 必须设置为 TRUE。
PHP:unpack()的用法_misc函数 unpack(PHP4,PHP5)unpackUnpackdatafrombinarystring说明arrayunpack(string$format,string$data)Unpacksfromabinarystringintoanarrayaccordingtothegivenformat.Theunpackeddataisstoredinanassociativearray.To
PHP:usleep()的用法_misc函数 usleep(PHP4,PHP5)usleep以指定的微秒数延迟执行说明voidusleep(int$micro_seconds)以指定的微秒数延缓程序的执行。参数micro_seconds暂停的时间以微秒计。1微秒(micro
PHP:time_nanosleep()的用法_misc函数 time_nanosleep(PHP5)time_nanosleep延缓执行若干秒和纳秒说明mixedtime_nanosleep(int$seconds,int$nanoseconds)程序延缓执行指定数量的seconds和nanoseconds。参数seconds必须是一
标签: phpunicode
本文链接地址:https://www.jiuchutong.com/biancheng/280620.html 转载请保留说明!友情链接: 武汉网站建设