完美

[学习|工作|博客|交流平台|完美起航]

作者头像admin2017.06.01 11:47 

PHP unpack() 函数

PHP unpack() 函数定义和用法unpack() 函数从二进制字符串对数据进行解包。语法unpack(format,data)参数描述format必需。规定在解包数据时所使用的格式。data可选。规定被解包的二进制数据。format 参数的可能值:a - NUL-padded stringA - SPACE-padded stringh - Hex string, low nibble firstH - Hex string, high nibble firstc - signed charC - unsigned chars - signed short (always 16 bit, machine byte order)S - unsigned short (always 16 bit, machine byte order)n - unsigned short (always 16 bit, big endian byte order)v - unsigned short (always 16 bit, little endian byte order)i - signed integer (machine dependent size and byte order)I - unsigned integer (machine dependent size and byte order)l - signed long (always 32 bit, machine byte order)L - unsigned long (always 32 bit, machine byte order)N - unsigned long (always 32 bit, big endian byte order)V - unsigned long (always 32 bit, little endian byte order)f - float (machine dependent size and representation)d - double (machine dependent size and representation)x - NUL byteX - Back up one byte@ - NUL-fill to absolute position例子例子 1<?php $data="PHP"; print_r(unpack("C*",$data)); ?>输出:Array ( [1]=>80 [2]=>72 [3]=>80 )例子 2<?php $data="PHP"; print_r(unpack("C*myint",$data)); ?>输出:Array ( [myint1]=>80 [myint2]=>72 [myint3]=>80 )例子 3<?php $bin=pack("c2n2",0x1234,0x5678,65,66); print_r(unpack("c2chars/n2int",$bin)); ?>输出:Array ( [chars1]=>52 [

unpack 2461 1

作者头像admin2017.06.01 11:47 

PHP usleep() 函数

PHP usleep() 函数定义和用法usleep() 函数延迟代码执行若干微秒。语法usleep(microseconds)参数描述microseconds必需。以微秒计的暂停时间。返回值无返回值。提示和注释注释:在 PHP 5 之前,该函数无法工作于 Windows 系统上。注释:一微秒等于百万分之一秒。例子<?php echodate(h:i:s)."<br/>"; //延迟10描述usleep(10000000);//再次开始 echodate(h:i:s); ?>输出:09:23:14 09:23:24

usleep 2468 2

作者头像admin2017.05.24 23:28 

php删除文件夹及文件夹下所有文件

php删除文件夹及文件夹下所有文件,代码如下<? functiondeldir($dir){ //先删除目录下的文件: $dh=opendir($dir); while($file=readdir($dh)){ if($file!="."&&$file!=".."){ $fullpath=$dir."/".$file; if(!is_dir($fullpath)){ unlink($fullpath); }else{ deldir($fullpath); } } } closedir($dh); //删除当前文件夹: if(rmdir($dir)){ returntrue; }else{ returnfalse; } } ?>

PHP 18348 9

a6bfb44cbd5549740eb36647f36ef83a