Http\Request

Http请求对象,保存了Http客户端请求的相关信息,包括GETPOSTCOOKIEHeader等。

  • Request对象销毁时会自动删除上传的临时文件
  • 请勿使用&符号引用$request对象

  • play_soso

        $_GET = $request->get;
        $_POST = $request->post;
        $_COOKIE = $request->cookie;
        $_FILES = $request->files;
    

  • 刘端坤

    对新手很有帮助 谢谢

  • liuwenbohhh

    1.9.6版本下,mac系统,get,post,file会出nodtice,PHP Notice: Undefined property: swoole_http_request::$get in /usr/local/var/www/test/index.php on line 5,PHP Notice: Undefined property: swoole_http_request::$post in /usr/local/var/www/test/index.php on line 7,PHP Notice: Undefined property: swoole_http_request::$files in /usr/local/var/www/test/index.php on line 9因为是mac系统的问题吗

  • 飘渺

    post上传多张图片貌似有bug,只有最后一张成功

  • 在那不遥远的地方丶

    是不是session需要自己去实现

  • swoole first

    获取不了GET参数,可能遇到什么

  • 从那以后

    php处理多图上传是图片的属性分别存,类似于

    Array
    (
        [name] => Array
            (
                [0] => foo.txt
                [1] => bar.txt
            )
    
        [type] => Array
            (
                [0] => text/plain
                [1] => text/plain
            )
    
        [tmp_name] => Array
            (
                [0] => /tmp/phpYzdqkD
                [1] => /tmp/phpeEwEWG
            )
    
        [error] => Array
            (
                [0] => 0
                [1] => 0
            )
    
        [size] => Array
            (
                [0] => 123
                [1] => 456
            )
    )
    ~~~,
    然而swoole处理多图上传的时候是类似于
    

    Array ( [0] => Array ( [name] => foo.txt [type] => text/plain [tmp_name] => /tmp/phpYzdqkD [error] => 0 [size] => 123 )

    [1] => Array
        (
            [name] => bar.txt
            [type] => text/plain
            [tmp_name] => /tmp/phpeEwEWG
            [error] => 0
            [size] => 456
        )
    

    ) ~~~ swoole这样做得初衷是什么

  • kepon

    当参数值带上一个@前缀时,为什么swoole_http_request->post这个参数值为空了。

  • 啧啧大丸子

    楼上,PHP前面加@是忽略的意思吧