$client = new Client([
'base_uri' => 'http://my.domain.com',
]);
$response = $client->request('POST','/?action=sys&opt=login',[
'action'=>'login',
'uName'=>'myUName',
'uPass'=>'myPwd',
]);
print_r($response->getHeader('Set-Cookie'));//此处打印正常Array([0] => PHPSESSID=22fosfolsvoqardv5atdg0cnr2; expires=Sat, 19-Jan-2019 03:45:38 GMT; path=/; domain=my.domain.com)
$cookie = substr((explode(';',($response->getHeader('Set-Cookie'))[0]))[0],10);
$jar = CookieJar::fromArray(['PHPSESSID'=>$cookie],'my.domain.com');
$response = $client->request('GET', '/?action=game&opt=gameindex&type=add',[
'cookies'=>$jar
]);
呼如林