查看文件: make_user2.php
大小: 1.26 KB
类型: application/octet-stream
<? function mychar($v){ $char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';//abcdefghijklmnopqrstuvwxyz';// W 26 *12 // echo ($v )."==> <br>"; if($v<14){ $str= substr($char,0,1).$v;} else{ $v=$v-2; $ch3=''; $ch2=''; $ch1=''; $c3=0; $c2=0; $c1=0; $c3t=0; $c2t=0; $c1t=0; $v1=floor($v/12 ); $c1=($v1 % 26) ; $c1t=floor($v/26/12); $ch1=substr($char,$c1,1) ; $ct=($v % 12)+1 ; if($c1t>0){ $c2=($c1t % 26) ; $ch2=substr($char,$c2-1,1) ;//$c2; } $c2t=floor($v/27/26/12); if($c2t>0){ $c3=($c2t % 26) ; $ch3=substr($char,$c3-1,1) ;//$c3; } $str=$ch3.$ch2.$ch1.$ct ; } return $str; } $hostName = "localhost"; $username = "root"; $password = "loskyoc"; $dbname = "newskybni"; $dblink = mysqli_connect($hostName, $username, $password, $dbname) or die(mysqli_error()); for ($i = 1; $i <24000; $i++) { $val=mychar($i); $p1=$i-2; $p=floor($p1/3)+1; $insert_sql = sprintf("insert into usertree1 (name,parentid)values('%s','%s')",$val,$p); mysqli_query($dblink,$insert_sql); echo $i."==>". mychar($i).'==>'.$p."<br>"; } ?>
保存
取消
返回文件列表