谁熟悉 lumen 框架,父类控制器怎么得到请求对象? request

2019-06-08 10:33:42 +08:00
 iamcookie
3519 次点击
所在节点    PHP
4 条回复
815979670
2019-06-08 10:36:53 +08:00
用构造函数
strcmp
2019-06-08 11:06:57 +08:00
request()
mamahaha
2019-06-08 14:59:58 +08:00
请求对象为模型字段,use 模型类
yeeling
2019-06-09 14:14:20 +08:00
```
if (! function_exists('request')) {
/**
* Get an instance of the current request or an input item from the request.
*
* @param string $key
* @param mixed $default
* @return \Illuminate\Http\Request|string|array
*/
function request($key = null, $default = null)
{
if (is_null($key)) {
return app('request');
}

return app('request')->input($key, $default);
}
}
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/571922

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX