PHP Hashids 方法
/** * 库:https://github.com/ivanakimov/hashids.php * 生成唯一字符串 * @param $str * @param string $salt * @param string $length * @param string $alphabet * @return false|string */ public static function hashids($str, $salt = '', $length = '', $alphabet = '') { $hashids = new Hashids($salt, $length, $alphabet); return $hashids->encode($str); } /** * hashids解析 * @param $str * @param string $salt * @param string $length * @param string $alphabet * @return false|string */ public static function decodehashids($str, $salt = '', $length = '', $alphabet = '') { $hashids = new Hashids($salt, $length, $alphabet); return $hashids->decode($str); }