我在routes.php中有以下方法:
$app->post('insertGender', function ($NAME) {
$result = DB::insert("INSERT INTO HK_GENDER (NAME) VALUES (?)",[$NAME]);
return ($result)? "wow":"Noo";
});
Missing argument 1 for Closure::{closure}()
in routes.php line 93
at Application->Laravel\Lumen\Concerns\{closure}('2', 'Missing argument 1 for Closure::{closure}()', '93', array()) in routes.php
at Closure->{closure}()
为什么提供的参数未使用?
答案 0 :(得分:0)
正确的方法是从请求中获取数据,如下所示:
$app->post('insertGender', function (Illuminate\Http\Request $request) {
$NAME = $request->input('NAME');
$result = DB::insert("INSERT INTO HK_GENDER (NAME) VALUES (?)",[$NAME]);
return ($result)? "wow":"Noo";
});