Business requirements for making a real estate browsing history
now the cookie, on the page has been invalid and cannot be overlaid. When printed out, the cookie is always empty.
head
Baidu said for a while, some said that the permissions were insufficient, and some said that the cookie life cycle was not set.
related codes
$ckhouse = Cookie::get ("loupan");
//Cookie::get("loupan");
print_r($ckhouse);
var_dump($ckhouse);
if (!empty($ckhouse)) {
echo 1;
in_array($id, $ckhouse) ? : $ckhouse[] = $id;
Cookie::set("loupan", $ckhouse);
$ckarr = array();
foreach ($ckhouse as $ck => $cv) {
$ckarr[] = Db::table(config("database.prefix") . "house")->field("*")->where("id=\"" . $cv . "\" and status=1 ")->order("id desc")->find();
}
//$ckarr["price_zong"] = $ckarr["price_zong"]/10000;
@$ckarr = array_reverse($ckarr);
$this->assign("ckarr", $ckarr);
} else {
$ckhouse[] = $id;
Cookie::set("loupan", $ckhouse);
$this->assign("ckarr", "");
}