src/Controller.php
private function ajax(string $msg): void
    {
        header("Content-Type: text/html; charset=utf-8");
        $req = $this->request;

        // 前一页地址
        //$referer = $req->referer;

        // 如果是JsonP
        if ($req and $req->callback) {
            $callback = $req->callback;
            echo $callback . '(' . $msg . ')';

        } else {
            // 普通Ajax
            echo $msg;
        }

        ($this->callback)($this);
    }
private function ajax(string $msg): void
    {
        header("Content-Type: text/html; charset=utf-8");
        $req = $this->request;

        // 前一页地址
        //$referer = $req->referer;

        // 如果是JsonP
        if ($req and $req->callback) {
            $callback = $req->callback;
            echo $callback . '(' . $msg . ')';

        } else {
            // 普通Ajax
            echo $msg;
        }

        ($this->callback)($this);
    }
输出Ajax结果
@param string $msg