Php 如何使数组的每一行分别显示在另一页上?
我不知道如何使我的表格的一行显示在另一页上。我想做的是使每一行都可以打印。这是一本书 以下是用于显示表的php(优惠券索引.php):Php 如何使数组的每一行分别显示在另一页上?,php,arrays,Php,Arrays,我不知道如何使我的表格的一行显示在另一页上。我想做的是使每一行都可以打印。这是一本书 以下是用于显示表的php(优惠券索引.php): 我的 类别: 没有可用的 交易项目凭证的编号用户的密码有效至电子邮件凭证 以及更多(index.php): 打印时每页输出一行的最简单解决方案是在CSS属性之前或之后使用分页符。也就是说,您需要在第一个或最后一个tr上抑制这些,这取决于您选择的路线 e、 g: <style> @media print { table tr {pag
我的
- 类别:
没有可用的
交易项目凭证的编号用户的密码有效至电子邮件凭证
以及更多(index.php):
打印时每页输出一行的最简单解决方案是在CSS属性之前或之后使用分页符。也就是说,您需要在第一个或最后一个tr上抑制这些,这取决于您选择的路线 e、 g:
<style>
@media print {
table tr {page-break-after:always}
}
</style>
@媒体印刷品{
表tr{page break after:always}
}
您需要传递相关优惠券的数据库rowID,或其一些变体。我会使用它的一些散列,可能是MD5,同时在远端检查会话人员是否是优惠券的所有者,优惠券是否有效
因此,您的打印链接将是:
<td><a href="/coupon/print.php{md5($one['id'])}">Send</a></td>
在优惠券_index.php中,我无法理解$2指的是什么。 您可能需要更好地命名和缩进这段代码,为要显示的行找到合适的id,并将此信息传递给相应的控制器,该控制器将只加载相关行 你想在“.php”之后加上“.hash=”是吗?
<!--{include header}-->
<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="coupons">
<div class="dashboard" id="dashboard">
<ul>${current_account('/coupon/index.php')}</ul>
</div>
<div id="content" class="coupons-box clear">
<div class="box clear">
<div class="box-top"></div>
<div class="box-content">
<div class="head">
<h2>My {$INI['system']['couponname']}</h2>
<ul class="filter">
<li class="label">Category: </li>
${current_coupon_sub('index')}
</ul>
</div>
<div class="sect">
<!--{if $selector=='index'&&!$coupons}-->
<div class="notice">There is no usable {$INI['system']['couponname']}</div>
<!--{/if}-->
<table id="orders-list" cellspacing="0" cellpadding="0" border="0" class="coupons-table">
<tr><th width="300">Deal Item</th><th width="100" nowrap>Voucher's Number</th><th width="60" nowrap>Voucher's Password</th><th width="100" nowrap>Valid Till</th><th width="40">Print Voucher</th></tr>
<!--{loop $coupons $index $one}-->
<tr ${$index%2?'':'class="alt"'}>
<td><a class="deal-title" href="/team.php?id={$one['team_id']}" target="_blank">{$teams[$one['team_id']]['title']}</a></td>
<td>{$one['id']}</td>
<td>{$one['secret']}</td>
<td>${date('Y-m-d', $one['expire_time'])}</td>
<td></td>
</tr>
<!--{/loop}-->
<tr><td colspan="5">{$pagestring}</td></tr>
</table>
</div>
</div>
<div class="box-bottom"></div>
</div>
</div>
<div id="sidebar">
</div>
</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->
<!--{include footer}-->
<style>
@media print {
table tr {page-break-after:always}
}
</style>
<td><a href="/coupon/print.php{md5($one['id'])}">Send</a></td>