php DES加密解密函数

php DES加密解密函数

/** * php DES解密函数 * * @param string $key 密钥 * @param string $encrypted 加密字符串 * @return string */ function des_decode($key, $encrypted){ $encrypted = base64_decode($encrypted); $td =...

PHP 2021-11-05 PM 1608次 0条
php 生成自动密码

php 生成自动密码

/** * 生成自动密码 */ function make_password(){ $temp = '0123456789abcdefghijklmnopqrstuvwxyz'. 'ABCDEFGHIJKMNPQRSTUVWXYZ~!@#$^*)_+}{}[]|":;,.'.time(); for($i=0;$i<10;$i++){...

PHP 2021-11-05 PM 2101次 0条
php 产生随机字串,可用来自动生成密码 默认长度6位 字母和数字混合

php 产生随机字串,可用来自动生成密码 默认长度6位 字母和数字混合

/** * 产生随机字串,可用来自动生成密码 默认长度6位 字母和数字混合 * * @param string $len 长度 * @param string $type 字串类型:0 字母 1 数字 2 大写字母 3 小写字母 4 中文 * 其他为数字字母混合(去掉了 容易混淆的字符oOLl和数字01,) * @param string $addChars 额外字符 ...

PHP 2021-11-05 PM 1746次 0条
delphi 字符串截取自动修复;(仅utf8 字符串); 去除前后不足一个字符的字节

delphi 字符串截取自动修复;(仅utf8 字符串); 去除前后不足一个字符的字节

/** * 字符串截取自动修复;(仅utf8 字符串); 去除前后不足一个字符的字节 * 截取多余部分用replace替换; * * $str = substr("我的中国心",1,-2); * $str = utf8Repair($str); * * 1 1-128 * 2 192-223, 128-191 * 3 224-239, 128-19...

PHP 2021-11-05 PM 1649次 0条
php 去掉HTML代码中的HTML标签,返回纯文本

php 去掉HTML代码中的HTML标签,返回纯文本

/** * 去掉HTML代码中的HTML标签,返回纯文本 * @param string $document 待处理的字符串 * @return string */ function html2txt($document){ $search = array ("'<script[^>]*?>.*?</>'si", // 去掉...

PHP 2021-11-05 PM 1611次 0条
php 去除json中注释部分; json允许注释

php 去除json中注释部分; json允许注释

// 去除json中注释部分; json允许注释 // 支持 // 和 /*...*/注释 function json_comment_clear($str){ $result = ''; $inComment = false; $commentType = '//';// /*,// $quoteCount = 0; $str = str_rep...

PHP 2021-11-05 PM 1118次 0条
php 字符串加转义

php 字符串加转义

// 字符串加转义 function add_slashes($string){ if (!$GLOBALS['magic_quotes_gpc']) { if (is_array($string)) { foreach($string as $key => $val) { $string[$key] = ...

PHP 2021-11-05 PM 1314次 0条
php 过滤js、css等

php 过滤js、css等

/** * 过滤js、css等 */ function filter_html($html){ $find = array( "/<(\/?)(script|i?frame|style|html|body|title|link|meta|\?|\%)([^>]*?)>/isU", "/(<[^...

PHP 2021-11-05 PM 1836次 0条
php 生成guid

php 生成guid

function guid(){ return md5(microtime(true).rand_string(20)); }

PHP 2021-11-05 PM 2146次 0条
php 获取精确时间

php 获取精确时间

/** * 获取精确时间 */ function mtime(){ $t= explode(' ',microtime()); $time = $t[0]+$t[1]; return $time; }

PHP 2021-11-05 PM 1646次 0条
php 根据id获取短标识

php 根据id获取短标识

/** * 根据id获取短标识; * 加入时间戳避免猜测;id不可逆 * * eg: 234==>4JdQ9Lgw; 100000000=>4LyUC2xQ */ function short_id($id){ $id = intval($id) + microtime(true)*10000; $id = pack('H*',base_conve...

PHP 2021-11-05 PM 1549次 0条