php - 如何在包含在 php 文件中的单引号内的 html 中编写 php 代码?
问题描述
$body = '<div data-shordcode="[woo_mb_items]"><div class="ywot_order_details top"><br></div> <h2>Order #2717</h2>
<table class="email_builder_table_items" cellspacing="0" cellpadding="6" style="width: 100% !important;" border="1" width="100%">
<thead>
<tr>
<th class="td" scope="col" style="text-align:left;">Product</th>
<th class="td" scope="col" style="text-align:left;">Quantity</th>
<th class="td" scope="col" style="text-align:left;">Price</th>
</tr>
</thead>
<tbody>
<tr class="order_item">
*php code*
<td class="td" style="text-align:left; vertical-align:middle;word-wrap:break-word;"><div style="margin-bottom: 5px"><img src="'.$thumbnail.$_SESSION['img_url'].'" alt="Product image" height="32" width="32" style="vertical-align:middle; margin-right: 10px;"></div>'. $_SESSION['product'] .'</td>
<td class="td" style="text-align:left; vertical-align:middle;">'. $_SESSION['quantity'] .'</td>
<td class="td" style="text-align:left; vertical-align:middle;"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>'. $_SESSION['total'] .'</span> <small class="woocommerce-Price-taxLabel tax_label">(ex. tax)</small></td>
</tr>
</tr>
</tbody>
<tfoot>
<tr>
<th class="td" scope="row" colspan="2" style="text-align:left; border-top-width: 1px">Subtotal:</th>
<td class="td" style="text-align:left; border-top-width: 1px;"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>'. $_SESSION['subtotal'] .'</span> <small class="tax_label">(ex. tax)</small></td>
</tr><tr>
<th class="td" scope="row" colspan="2" style="text-align:left; ">Shipping:</th>
<td class="td" style="text-align:left; ">'. $_SESSION['shipping'] .'</td>
</tr><tr>
<th class="td" scope="row" colspan="2" style="text-align:left; ">Payment method:</th>
<td class="td" style="text-align:left; ">'. $_SESSION['payment'] .'</td>
</tr><tr>
<th class="td" scope="row" colspan="2" style="text-align:left; ">Total:</th>
<td class="td" style="text-align:left; "><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>'. $_SESSION['total'] .'</span></td>
</tr>
</tfoot>
</table>
</div>';
我想在我指定php 代码的地方编写 php 循环,以便那里的表 data() 将重复我的时间作为给定数组中的结果数。我也尝试过php 标签和连接,但这些似乎都不起作用。有没有办法做到这一点?...任何建议将不胜感激..
解决方案
推荐阅读
- go - VS Code 中除 main.go 之外的调试文件
- java - 配置文件的Maven问题
- javascript - 未捕获的类型错误:无法在 @material-ui/...../ClickAwayListener/ 处读取未定义的属性“isRequired”
- regression - 如何在 XGBoost Regressor 中找到模型的系数?
- sql - 基于 SQL 的覆盖 http 应用程序的用户身份验证
- linux - AttributeError:“NoneType”对象没有属性“implicitly_wait”
- mysql - 如何将 'Mon Jul 22 14:51:34 IST 2019' 转换为 '2019-07-22'
- java - 如何为 System.in Scanner 输入添加事件侦听器?
- java - 如何使用 SNMP4J 在 OID / Managed Object 上注册侦听器以执行设置或获取代理接收的请求?
- ios - 无法对 com.mydomain.demoapp 执行操作“Promote”,因为它当前不受支持