Model.request_parse - kouji6309/SingleMVC GitHub Wiki

說明

解析請求的回應。通常不需要用到它,僅在回應有多個 header 時 (通常是有用 Proxy 導致的),再次解析回應的 header 與 content。


原型

protected static request_parse(string $response) : array

參數

  • response
    回應資料。

回應

  • 陣列:已解析的 header 和 content。

應用

再次解析內容

$response = self::request('https://www.example.com/api/news', 'GET', [], [
    'Proxy' => '127.0.0.1:8888'
], true);
$response = self::request_parse($response['content']);

$header = $response['header'];
$content = $response['content'];
⚠️ **GitHub.com Fallback** ⚠️