Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- |--------------------------------------------------------------------------
- | 安全随机字符串
- |--------------------------------------------------------------------------
- |
- | 安全随机安字符串函数使用。
- |
- */
- echo bin2hex(openssl_random_pseudo_bytes(128));
- // 拓展生成订单号
- function generateOrderId($lenght = 13)
- {
- return date('ymd') . bin2hex(openssl_random_pseudo_bytes(ceil($lenght / 2))) . str_pad(rand(1, 9999), 5, 0, STR_PAD_LEFT);
- }
- echo generateOrderId();
Add Comment
Please, Sign In to add comment