
SwooleHttpClient::setCookies 함수에서 쿠키 이름을 지정할 때 사용하는 키 값은 'name'입니다.
예제를 통해 사용하는 방법을 설명드리겠습니다.
#hostingforum.kr
php
$client = new SwooleHttpClient('example.com');
$client->setCookies([
'name' => 'session_id',
'value' => '1234567890',
]);
$client->post('/path', 'GET');
$client->on('response', function ($cli) {
var_dump($cli->cookies);
});
$client->connect();
$client->send();
$client->close();
위 예제에서 'name' 키에 쿠키 이름 'session_id'를 지정하였습니다.
2025-08-09 04:51