欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php中实现产品展示$classify=array("")方法如何将产品介绍分类添加进txt文件中

程序员文章站 2022-05-06 09:16:14
...
php类

已实现通过读取txt文档进行产品展示,如何跟据不同产品种类分类添加产品介绍?

plantslist.txt:
$plantsclassify=array("产品种类","产品种类","产品种类");
$产品种类=array(array("产品名称","介绍",价格),array("名称","介绍",价格),array("名称","介绍",价格));
$产品种类=array(array("产品名称","介绍",价格),array("名称","介绍",价格),array("名称","介绍",价格));
$产品种类=array(array("产品名称","介绍",价格),array("名称","介绍",价格),array("名称","介绍",价格));
?>

include("plantslist.txt");
foreach($plantsclassify as $classify)
{
echo "$classify ";
}
echo "查看购物车";
if(isset($_GET["catalog"]))
{
$catalog=$_GET["catalog"];
$_SESSION["catalog"]=$catalog;
echo "

";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
foreach($$catalog as $plants)
{
echo "";
foreach ($plants as $val)
{
echo "";
}
echo "";
echo "";
}
echo "";
echo "";
echo "";
echo "
植物名详细信息价格购买
$val
";
echo "";
}
if(isset($_GET["success"]))
{
if($_GET["success"]==0)
{
echo "alert('请选购植物')";
}
if($_GET["success"]==1)
{
echo "alert('已加入购物车!')";
}
}
?>
相关标签: php