iamcookie
V2EX  ›  PHP

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

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