convert($string); $shouzimu = ''; if(!empty($pinyin_arr)){ foreach($pinyin_arr as $key => $val){ $shouzimu .= strtoupper(substr($val,0,1)); } } return $shouzimu; } /** * 无需登录的接口 * */ public function test1() { $list = Db::name('video')->where('search_title','')->select(); foreach($list as $key => $video){ $shouzimu = $this->shouzimu($video['title']); Db::name('video')->where('id',$video['id'])->update(['search_title'=>$shouzimu]); } } /** * 需要登录的接口 * */ public function test2() { $this->success('返回成功', ['action' => 'test2']); } /** * 需要登录且需要验证有相应组的权限 * */ public function test3() { $this->success('返回成功', ['action' => 'test3']); } }