SunshinePHP Developer Conference 2015

HttpRequest::addCookies

(PECL pecl_http >= 0.10.0)

HttpRequest::addCookiesAdd cookies

说明

public bool HttpRequest::addCookies ( array $cookies )

Add custom cookies.

Note: request 选项 encodecookies 控制 cookie 值是否应被 urlencode() 编码。

Note: 影响任意请求方法。

参数

cookies

an associative array containing any cookie name/value pairs to add

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

Example #1 A HttpRequest::addCookies() example

<?php
$r 
= new HttpRequest;
$r->addCookies(
    array(
        
"cookie_name" => "cookie value",
    )
);
?>

参见

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top