Php generates the short domain name function, and php generates the domain name function. Php generate short domain name function, php generate domain name function php generate short domain name function publicfunctioncreateRandCode ($ string) {$ code; $ hex_code1qaz2wsx3edc4rfv5t-gb6yhn7ujm8ik9ol0p _ php generate short domain name function, php generate domain name function
Php short domain name generation function
Public function createRandCode ($ string) {$ code = ''; $ hex_code = '1qaz2wsx3edc4rfv5t-gb6yhn7ujm8ik9ol0p _ '; $ now = microtime (true) * 10000; $ strlen = strlen ($ hex_code); $ hash_code = hash ('sha256 ', $ string); // A random length is defined for the encoding, length depends on step $ step = rand (8, 16); $ count = ceil (strlen ($ hash_code)/$ step); for ($ I = 0; $ I <$ count; $ I ++) {$ start = $ I * $ step; $ hex_num = substr ($ hash_code, $ start, $ step ); $ num = 0x3fffffff & (1 * '0x '. $ hex_num); $ n = $ num % $ strlen; $ code. = $ hex_code [$ n];} return $ code ;}
The above is all the content of the code shared in this article. I hope you will like it.
Using php to generate the short domain name function public function createRandCode ($ string) {$ code = ''; $ hex_code = '1qaz2wsx3edc4rfv5t-gb6yhn7ujm8ik9ol0p _'...