1 <?php 2 function generate_code($length = 4) { 3 return rand(pow(10,($length-1)), pow(10,$length)-1); 4 } 5 6 echo generate_code();
1 <?php 2 function generate_code($length = 4) { 3 return rand(pow(10,($length-1)), pow(10,$length)-1); 4 } 5 6 echo generate_code();
转载于:https://www.cnblogs.com/wujindong/p/5429722.html