update
This commit is contained in:
@@ -20,4 +20,26 @@ class Index extends Api
|
|||||||
{
|
{
|
||||||
$this->success('请求成功');
|
$this->success('请求成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GetRandStr($length){
|
||||||
|
//字符组合
|
||||||
|
$str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||||
|
$len = strlen($str)-1;
|
||||||
|
$randstr = '';
|
||||||
|
for ($i=0;$i<$length;$i++) {
|
||||||
|
$num=mt_rand(0,$len);
|
||||||
|
$randstr .= $str[$num];
|
||||||
|
}
|
||||||
|
return $randstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addStu()
|
||||||
|
{
|
||||||
|
$li = db('student')->find();
|
||||||
|
$array = array('identifier'=>rand(10000,99999),'nickname'=>$this->GetRandStr(8),'mobile'=>rand(10000000000,99999999999),'password'=>$this->GetRandStr(8),'avatar'=>'/uploads/20220908/b7c04fd15608f8b905d9808a401c9c02.jpg','gender'=>1,'birthday'=>'2022-08-08','age'=>10,'type'=>1,'disabled'=>0,'city'=>'哈尔滨','school'=>'xxx小学');
|
||||||
|
for ($i=1; $i<=50; $i++)
|
||||||
|
{
|
||||||
|
db('student')->insert($array);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user