PHP 通知:未定义的偏移量:1 - GraphRawResponse.php

我收到此 PHP 错误:


Undefined offset: 1

代码是:


public function setHttpResponseCodeFromHeader($rawResponseHeader)

{

    preg_match('|HTTP/\d\.\d\s+(\d+)\s+.*|', $rawResponseHeader, $match);

    $this->httpResponseCode = (int)$match[1];

}

如何解决这个错误?


慕的地8271018
浏览 151回答 1
1回答

梵蒂冈之花

数组 $match 在您访问它之前是否已初始化?在访问 $match 之前尝试一下$match = [];//or$match = array();
打开App,查看更多内容
随时随地看视频慕课网APP