V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iamcookie
V2EX  ›  PHP

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

  •  
  •   iamcookie · 2019-06-08 10:33:42 +08:00 · 3482 次点击
    这是一个创建于 1755 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    2019-06-09 14:14:20 +08:00
    815979670
        1
    815979670  
       2019-06-08 10:36:53 +08:00 via Android
    用构造函数
    strcmp
        2
    strcmp  
       2019-06-08 11:06:57 +08:00
    request()
    mamahaha
        3
    mamahaha  
       2019-06-08 14:59:58 +08:00
    请求对象为模型字段,use 模型类
    yeeling
        4
    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);
    }
    }
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1029 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 19:20 · PVG 03:20 · LAX 12:20 · JFK 15:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.