💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
#### Cookie保存数组数据方法 `serialize()`和`unserialize()` ~~~ /** * [saveArrToCookie 暂存模拟数据到Cookie] * @param [type] $key [description] * @param [type] $content [description] * @return [type] [description] */ public function saveArrToCookie($key, $content) { $data = serialize($content); // 设置 cookie($key, $data, 3600); } ~~~ 查询Cookie数据,如果存在则取,如果不存在则创建并且保存数据到Cookie ~~~ //初始化 cookie(['prefix' => 'report_', 'expire' => 3600]); //开奖完整历史数据 if (Cookie::has('top100')) { $full_data = unserialize(Cookie::get('top100')); } else { $full_data = $this->getHistorydata(100); $this->saveArrToCookie('top100', $full_data); } ~~~