本文整理汇总了PHP中session::getSessionNum方法的典型用法代码示例。如果您正苦于以下问题:PHP session::getSessionNum方法的具体用法?PHP session::getSessionNum怎么用?PHP session::getSessionNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session
的用法示例。
在下文中一共展示了session::getSessionNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMycartInnerhtml
function getMycartInnerhtml()
{
$ses = new session();
$back = '';
if (isset($_SESSION['shop']) and count($_SESSION['shop']) != 0) {
$price = 0;
foreach ($_SESSION['shop'] as $s) {
$back .= "\n\t\t\t\t\t<span class='prod'>\n\t\t\t\t\t<span class='img'><img src='{$s['pro_img']}' alt='IMG'></span>\n\t\t\t\t\t<span class='name'>{$s['pro_name']}</span>\n\t\t\t\t\t<span class='price'>单价:" . number_format($s['pro_nowprice'], 0, '.', '') . "</span>\n\t\t\t\t\t<span class='num'>数目:{$s['num']}</span>\n\t\t\t\t\t<span class='delete' onclick='clearProduct(this,{id:{$s['pro_id']}})'>删除</span>\n\t\t\t\t\t</span>\n\t\t\t\t";
$price += $s['pro_nowprice'] * $s['num'];
}
$back .= "\n\t\t\t\t<input type='hidden' id='duoshaoge' value='" . $ses->getSessionNum() . "'>\n\t\t\t\t<span class='prod'><span class='final_price'>总计:¥{$price}</span><a href='mycart.php'><span id='buy_now'>立即购买</span></a></span>\n\t\t\t";
} else {
$back .= "<div style='width:240px;line-height:60px;text-align:center;'>您的购物车还没有商品哦~</div>";
}
return $back;
}
示例2: session
$ses->start();
echo $page->getMycartInnerhtml();
break;
case 10:
//clear prod
$ses = new session();
$ses->start();
unset($_SESSION['shop'][$_POST['proId']]);
echo "{\"back\":[{\"isok\":\"1\",\"info\":\"\"}]}";
break;
case 11:
$ses = new session();
$ses->start();
$sql = new mysql();
$dbc = $sql->connect();
$num = $ses->getSessionNum();
$store = array();
foreach ($_SESSION['shop'] as $v) {
$store[] = $v['pro_id'] . '=' . $v['num'];
}
$order_biaoji = time() . rand(1000, 9999);
$order_str = implode(',', $store);
$order_username = safe($_POST['person']);
$order_phone = safe($_POST['phone']);
$order_address = safe($_POST['address']);
$query = sprintf("INSERT INTO orders (order_biaoji,order_str,order_username,order_phone,order_address) VALUES('%s','%s','%s','%s','%s')", $order_biaoji, $order_str, $order_username, $order_phone, $order_address);
$_SESSION['order_biaoji'] = $order_biaoji;
setcookie('order_biaoji', $order_biaoji, time() + 3600);
$_SESSION['shop'] = array();
mysql_query('set names utf8');
if (mysql_query($query, $dbc)) {