z12345678zsy
z12345678zsy
采纳率0%
2015-07-05 15:23 阅读 1.5k

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

1

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

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

<?php

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(&#39;请选购植物&#39;)";
}
if($_GET["success"]==1)
{
echo "alert(&#39;已加入购物车!&#39;)";
}
}
?>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • yukon12345 yukon12345 2015-07-06 02:23

    这也能叫读取txt? 不如直接改成php文件好了。
    操作文件读写需要fopen fread fwrite

    点赞 评论 复制链接分享

相关推荐