• 欢迎访问小杰博客网站
  • 欢迎访问小杰博客网站哦

php导出csv模板

未分类 小杰 9年前 (2015-04-10) 1194次浏览 已收录 0个评论

php 部分:

$smarty->assign ( ‘storage_list’, $storage_list );

header ( “Content-type:application/vnd.ms-excel” );
header ( “Content-Disposition:filename=” . iconv ( “UTF-8”, “GB18030”, “库存汇总清单” ) . “.csv” );
$out = $smarty->fetch ( ‘oukooext/inventory_list_csv.htm’ );
echo iconv ( “UTF-8”, “GB18030”, $out );
exit ();

htm部分:

商品名,是否全新,条码,仓库,库位,总数量
{foreach from=$storage_list  item=goods}
{if $goods.location_validity_list}
{foreach from=$goods.location_validity_list key=key item=product}
“{$goods.goods_name}”,{if $goods.status_id == ‘INV_STTS_AVAILABLE’}全新{else}二手{/if},=”{$goods.barcode}”,=”{$goods.facility_name}”,{$product.location_barcode},{$goods.storage_count}
{/foreach}
{else}
“{$goods.goods_name}”,{if $goods.status_id == ‘INV_STTS_AVAILABLE’}全新{else}二手{/if},=”{$goods.barcode}”,=”{$goods.facility_name}”,””,{$goods.storage_count}
{/if}
{/foreach}


小杰博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php导出csv模板
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址