曲径通幽论坛

标题: setrawcookie() -- 发送未经URL编码的 cookie [打印本页]

作者: beyes    时间: 2012-6-12 14:46
标题: setrawcookie() -- 发送未经URL编码的 cookie
如果用setcookie() 函数设置的 cookie 中含有中文,那么这些中文在 cookie 文件中是以 URL 编码格式呈现的。如果不希望被编码,可以使用 setarwcookie() 函数,语法格式如下:
[Plain Text] 纯文本查看 复制代码
bool setrawcookie( string $name[, string $value[, int $expire = 0[, string $path[, string $domain[, bool $secure = false[, bool $httponly = false]]]]]] )

它的参数说明等同于 setcookie() 函数。

比如使用 setcookie() 函数设置的 cookie 为:
[attach]611[/attach]
在查看其生成的 cookie 时:
[attach]612[/attach]
上面的“曲径通幽” 4 个字是以 URL 编码形式存在,此处的 URL 编码采用的是 UTF-8 编码。

改用 setarwcookie() 函数后:
[attach]614[/attach]
此时没有被编码了:
[attach]613[/attach]




欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2