【发布时间】:2016-09-16 00:52:30
【问题描述】:
大家好,我是 php 新手。我想创建一个 html 表的字符串,以便以后使用它 mpdf,但是在构建我的表的过程中,代码似乎还可以,但是没有生成数据的 html 表。
下面是我的代码:
$html ='<div class="row">
<div class="col-lg-12">
<table width="100%" class="table table-striped table bordered">
<thead>
<tr>
<th class="text-left">Code</th>
<th class="text-left">Phone Number</th>
<th class="text-left">Delivery Date</th>
<th class="text-left">Amount HT</th>
<th class="text-left">Amount TVA</th>
<th class="text-left">Amount TTC</th>
<th class="text-left">Payment Mode</th>
</tr>
</thead >
<tbody>';
foreach($estimateArray as $item):
if(($startDate <= date_create($item->created) && date_create($item->created) <= $endDate)){
$html .= ' <tr>
<td class="text-left">'; echo $item->customer_name;'</td>
<td class="text-left">'; echo $item->document_number;'</td>
<td class="text-left">'; echo $item->delivery_date;'</td>
<td class="text-left">'; echo $item->amount_ht;'</td>
<td class="text-left">'; echo $item->amount_tva;'</td>
<td class="text-left">'; echo $item->amount_ttc;'</td>
<td class="text-left">'; echo $item->payment_mode;'</td>
</tr>';
} endforeach;
$html .= '
</tbody>
</table>
</div>
</div>
';
我需要帮助。
【问题讨论】: