💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ if (Request::instance()->isPost()) { //不知道以下哪种方法效率最高哦? //User模型静态调用 /* $new_user['user_name'] = Request::instance()->post('user_name'); $new_user['user_password'] = Request::instance()->post('user_password'); if ($result = User::create($new_user)) { return '用户[ ' . $result->user_name . ':' . $result->id . ' ]新增成功'; } else { return '新增出错'; } */ //实例化User模型(不成功) $user = new User; $new_user['user_name'] = Request::instance()->post('user_name'); $new_user['user_password'] = Request::instance()->post('user_password'); $user->data($new_user); $result = $user->save(); if ($result) { return '新增了'.$result.'条数据'; } else { return '新增出错'; } /* //使用助手函数 $user = model('User'); $new_user['user_name'] = input('post.user_name'); $new_user['user_password'] = input('post.user_password'); $user->data($new_user); $result = $user->save(); if ($result) { return '新增了'.$result.'条数据'; } else { return '新增出错'; } */ }else{ return '请检查请求类型。'; } ~~~