Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'test.php';
- $t = Token::gen(10);
- echo $t;
- echo "n";
- <?php
- class Token {
- public static function gen($len = 5)
- {
- $token = '';
- while($len--){
- $choose = rand(0, 2);
- if ($choose === 0)
- $token .= chr(rand(ord('A'), ord('Z')));
- else if($choose === 1)
- $token .= chr(rand(ord('a'), ord('z')));
- else
- $token .= chr(rand(ord('0'), ord('9')));
- }
- return $token;
- }
- }
- > php.exe .t1.php
- 308AXoL3zs
- > php.exe .t1.php
- g18tZZHgv3
- > php.exe .t1.php
- Chk7ir55g4
- > php.exe .t1.php
- 33oRvjqqYf
Add Comment
Please, Sign In to add comment