public function setCookieString($string){
$result = array();
if(preg_match_all('/\s*([^;=]+)=([^;]+)/i',$string,$matches) > 0){
if(isset($matches[1]) && isset($matches[2])){
if(count($matches[1]) == count($matches[2])){
foreach ($matches[1] as $handle => $key) {
$result[$key] = $matches[2][$handle];
}
}
}
}
return $result;
}
PHP
Cookie字符串转数组
评论 0
还没有评论,来说两句吧。