Home  >  Article  >  php教程  >  PHP4 Session实现的迷你购物篮四

PHP4 Session实现的迷你购物篮四

WBOY
WBOYOriginal
2016-06-13 10:28:221256browse

片段3。创建新的篮子并向其中增加一条项目
$#@60;?php
// 将项目计数设为1
$ses_basket_items=1;
// 填充4个数组的第0个位置,使用从href链接传过来的值
// 链接是在‘给你的页面增加链接’部分所讲的
$ses_basket_name[0]=$basket;
$ses_basket_amount[0]=1;
$ses_basket_price[0]=$price;
$ses_basket_id[0]=$id;
// 在session中注册新的篮子
session_register("ses_basket_items");
session_register("ses_basket_name");
session_register("ses_basket_amount");
session_register("ses_basket_price");
session_register("ses_basket_id");
?$#@62;
  这样将创建一个篮子,将所以的值填在数组第0个位置上,并利用session注册数组。一个篮子诞生了。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php进阶实现无限分类4Next article:ApacheReferenceManual4