话不多说,直接上代码
$arr = 'errorType=curlerror error_message=cURL error 7: couldn\'t connect to host Array ( [Host] => s109.360.qkzj.game-as.com ';
$pattern = '/(errorType)(.*)(?)(Array)/'; //errorType Array为开头 结尾字符串
preg_match_all($pattern, $arr, $matches);
var_dump($matches);
$matches[0][0]; //带有开头和结尾
$matches[1][0]; //开头
$matches[2][0]; //去除开头和结尾
$matches[3][0]; //结尾