PHP generates a short domain name function, PHP generates a domain name function
PHP generates a short domain name function
Public Function Createrandcode ($string) { $code = '; $hex _code = ' 1qaz2wsx3edc4rfv5t-gb6yhn7ujm8ik9ol0p_ '; $now = Microtime (True) * 10000; $strlen = strlen ($hex _code); $hash _code = hash (' sha256 ', $string); This defines a random length for the encoding, depending on the step $step = rand (8, +); $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 the article to share the entire content of the code, I hope you can like.
http://www.bkjia.com/PHPjc/972645.html www.bkjia.com true http://www.bkjia.com/PHPjc/972645.html techarticle PHP generates a short domain name function, PHP generates a domain name function PHP generates a short domain name function, public function Createrandcode ($string) {$code = "; $hex _code = ' 1qaz2wsx3edc4rfv5t -gb6yhn7ujm8ik9ol0p_ ' ...