码迷,mamicode.com
首页 > Web开发 > 详细

products.php

时间:2020-03-11 23:28:46      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:rod   products   cti   tsp   order   aci   table   price   images   

<?php
$products = [
    [‘id‘ => 1, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
    [‘id‘ => 2, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
    [‘id‘ => 3, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
    [‘id‘ => 4, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
    [‘id‘ => 5, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
    [‘id‘ => 6, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
    [‘id‘ => 7, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
    [‘id‘ => 8, ‘productName‘ => ‘商品1‘, ‘productsPrice‘ => 500, ‘productImage‘ => ‘a1.jpg‘],
];
$html = ‘<table width="100%" cellpadding="10" cellpacing="0" border="1">‘;
$html .= ‘<tr>‘;
$html .= ‘<td>编号</td>‘;
$html .= ‘<td>商品名称</td>‘;
$html .= ‘<td>价格</td>‘;
$html .= ‘<td>图片</td>‘;
$html .= ‘</tr>‘;
foreach($products as product){
    $html .= ‘<tr>‘;
    $html .= ‘<td>‘ . $product[‘id‘] . ‘</td>‘;
    $html .= ‘<td>‘ . $product[‘productName‘] . ‘</td>‘;
    $html .= ‘<td>‘ . $product[‘productsPrice‘] . ‘</td>‘;
    //a1.jpg
    $html .= ‘<td><img src="images/‘ . $product[‘productImage‘] . ‘"></td>‘;
    $html .= ‘</tr>‘;
}
$html .= ‘</table>‘;
echo $html;

products.php

标签:rod   products   cti   tsp   order   aci   table   price   images   

原文地址:https://www.cnblogs.com/lujieting/p/12466228.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!