iamcookie
V2EX  ›  PHP

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

  •  
  •   iamcookie · Jun 8, 2019 · 4494 views
    This topic created in 2556 days ago, the information mentioned may be changed or developed.
    4 replies    2019-06-09 14:14:20 +08:00
    815979670
        1
    815979670  
       Jun 8, 2019 via Android
    用构造函数
    strcmp
        2
    strcmp  
       Jun 8, 2019
    request()
    mamahaha
        3
    mamahaha  
       Jun 8, 2019
    请求对象为模型字段,use 模型类
    yeeling
        4
    yeeling  
       Jun 9, 2019
    ```
    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);
    }
    }
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2791 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 09:34 · PVG 17:34 · LAX 02:34 · JFK 05:34
    ♥ Do have faith in what you're doing.