first commit
This commit is contained in:
26
pgserver/application/lib/HexUtil.php
Normal file
26
pgserver/application/lib/HexUtil.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace app\lib;
|
||||
|
||||
/**
|
||||
* Hex工具类
|
||||
*/
|
||||
class HexUtil {
|
||||
/**
|
||||
* 16进制字符串转字节数组
|
||||
* @param string $hex 16进制字符串
|
||||
* @return string 字节数组
|
||||
*/
|
||||
public static function decodeHex($hex) {
|
||||
return hex2bin($hex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节数组转16进制字符串
|
||||
* @param string $bytes 字节数组
|
||||
* @return string 16进制字符串
|
||||
*/
|
||||
public static function encodeHexStr($bytes) {
|
||||
return bin2hex($bytes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user