$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 = ‘
‘;
$html .= ‘
‘;
$html .= ‘
编号 | ‘;
$html .= ‘
商品名称 | ‘;
$html .= ‘
价格 | ‘;
$html .= ‘
图片 | ‘;
$html .= ‘
‘;
foreach($products as product){
$html .= ‘
‘;
$html .= ‘
‘ . $product[‘id‘] . ‘ | ‘;
$html .= ‘
‘ . $product[‘productName‘] . ‘ | ‘;
$html .= ‘
‘ . $product[‘productsPrice‘] . ‘ | ‘;
//a1.jpg
$html .= ‘
| ‘;
$html .= ‘
‘;
}
$html .= ‘
‘;
echo $html;