public function fakeUser() { $this->login(); $batch = Input::get('batch', 0); if (!$batch) { echo "need batch number"; die; } $mobile = DB::table('users')->select('u_mobile')->where('u_mobile', '<', '11000000000')->orderBy('u_mobile', 'DESC')->first(); if (empty($mobile->u_mobile)) { $mobile = 10000000000; } else { $mobile = $mobile->u_mobile; } echo "mobile start at " . $mobile . "</br>"; echo "batch number is " . $batch . "</br>"; set_time_limit(0); $file = new Filesystem(); $re = $file->files('/var/www/qingnianchuangke/head_img'); foreach ($re as $key => $path) { $user = new User(); $user->u_mobile = ++$mobile; $user->u_name = $user->u_nickname = $file->name($path); $ext = $file->extension($path); echo "add:" . $user->u_name . "</br>"; $user->u_head_img = 'http://qnck001.oss-cn-hangzhou.aliyuncs.com/user_head/' . $batch . '/' . ($key + 1) . '.' . $ext; $user->fakeUser(); } echo 'done'; }