SimpleRequest.php 929 字节
<?php

namespace jiaoyin;

class SimpleRequest
{
    public string $path;
    public string $uri;
    public array  $get;
    public array  $post;
    public string $method;
    public array  $header;
    public array  $cookie;
    public string $rawContent;

    public function __construct($data)
    {
        $this->path   = $data['path'];
        $this->uri    = $data['uri'];
        $this->get    = $data['get'];
        $this->post   = $data['post'];
        $this->method = $data['method'];
        $this->header = $data['header'];
        $this->cookie = $data['cookie'];
        $this->rawContent = isset($data['rawContent']) ? $data['rawContent'] : '';
        if ($this->method == 'POST') {
            if (count($this->post) == 0) {
                $data = json_decode($this->rawContent, true);
                if ($data) {
                    $this->post = $data;
                }
            }
        }
    }
}