src/Leevel/Http/Request.php
public function isAcceptJson(): bool
    {
        $field = static::VAR_ACCEPT_JSON;

        if ($this->request->has($field) || $this->query->has($field)) {
            return true;
        }

        if ($this->isAjax() && !$this->isPjax() && $this->isAcceptAny()) {
            return true;
        }

        return $this->isRealAcceptJson();
    }
public function isAcceptJson(): bool
    {
        $field = static::VAR_ACCEPT_JSON;

        if ($this->request->has($field) || $this->query->has($field)) {
            return true;
        }

        if ($this->isAjax() && !$this->isPjax() && $this->isAcceptAny()) {
            return true;
        }

        return $this->isRealAcceptJson();
    }
是否为接受 json 请求.

@return bool