首页 > 代码库 > session_start() [function.session-start]:
session_start() [function.session-start]:
我在学习PHP的,当我尝试做在session_start() - 获取有关错误信息不能发送会话cookie。
我看到在这个问题上前面的问题,但是,仍然不能确定我的错误。
如果是错误家伙?
<?php
session_start();
if ($_POST[‘add‘])
{
foreach ($_POST[‘a_qty‘] as $k => $v)
{
$_SESSION[‘cart‘][$k] = $_SESSION[‘cart‘][$k] + $v;
}
}
?>
<?php
// look for catalog file
$catalogfile = "catalog.dat";
// file is avaialbe, extract data from it and place into $catalog, with sku as key
if (file_exists($catalogfile))
{
$data = http://www.mamicode.com/file($catalogfile);
foreach ($data as $line)
{
$lineArray = explode(":", $line);
$sku = trim($lineArray[0]);
$CATALOG[$sku][‘desc‘] = trim($lineArray[1]);
(www.111cn.net) $CATALOG[$sku][‘price‘] = trim($lineArray[2]);
}
}
else
{
die("Could not find the catalog file");
}
?>
<table border="1" cellspacing="10">
<?php
// print items from the catalog for selection
foreach ($CATALOG as $k => $v)
{
echo "<tr><td colspan=2 width=750>";
echo "<b>" . $v[‘desc‘] . "</b>";
echo "</td></tr>";
echo "<tr><td>";
echo "Price per unit: " . $CATALOG[$k][‘price‘];
echo "</td><td>Quantity: ";
echo "<input size=4 type=text name="a_qty[" . $k . "]">";
echo "</td></tr> ";
}
?>
from:http://www.111cn.net/phper/21/2de12f9039ff28ce01ffa0e274bb51f3.htm
我看到在这个问题上前面的问题,但是,仍然不能确定我的错误。
如果是错误家伙?
<?php
session_start();
if ($_POST[‘add‘])
{
foreach ($_POST[‘a_qty‘] as $k => $v)
{
$_SESSION[‘cart‘][$k] = $_SESSION[‘cart‘][$k] + $v;
}
}
?>
<?php
// look for catalog file
$catalogfile = "catalog.dat";
// file is avaialbe, extract data from it and place into $catalog, with sku as key
if (file_exists($catalogfile))
{
$data = http://www.mamicode.com/file($catalogfile);
foreach ($data as $line)
{
$lineArray = explode(":", $line);
$sku = trim($lineArray[0]);
$CATALOG[$sku][‘desc‘] = trim($lineArray[1]);
(www.111cn.net) $CATALOG[$sku][‘price‘] = trim($lineArray[2]);
}
}
else
{
die("Could not find the catalog file");
}
?>
<table border="1" cellspacing="10">
<?php
// print items from the catalog for selection
foreach ($CATALOG as $k => $v)
{
echo "<tr><td colspan=2 width=750>";
echo "<b>" . $v[‘desc‘] . "</b>";
echo "</td></tr>";
echo "<tr><td>";
echo "Price per unit: " . $CATALOG[$k][‘price‘];
echo "</td><td>Quantity: ";
echo "<input size=4 type=text name="a_qty[" . $k . "]">";
echo "</td></tr> ";
}
?>
from:http://www.111cn.net/phper/21/2de12f9039ff28ce01ffa0e274bb51f3.htm
session_start() [function.session-start]:
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。