[PHP]代码
/* 记录浏览历史 */
if (!empty($_COOKIE['history']))
{
if(stripos($_COOKIE['history'].',',$goods_id.',')===false){
$history = explode(',', $_COOKIE['history']);
array_unshift($history, $goods_id); //入栈
while (count($history) > 5) //大于容器容量
{
array_pop($history); //出栈
}
setcookie('history', implode(',', $history), gmtime() + 3600 * 24 * 30);
}
}
else
{
setcookie('history', $goods_id, gmtime() + 3600 * 24 * 30);
}
使用官方Model Context Protocol PHP SDK将PHP应用程序功能暴露为MCP工具、资源和提示,用于代理工作流。
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










