zoukankan      html  css  js  c++  java
  • products.php

    <?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;
  • 相关阅读:
    基于jquery. cookie 防刷新重复点击获取验证码
    Mysql常用命令详解
    20种常用的DOS命令小结
    php 常用正则表达式
    VBA Excel 常用 自定义函数
    VBA Mysql 类
    VBA Excel 引用 API,以实现“透明”
    VBA Excel 打印
    VBA Excel 单元格操作
    php上传常见文件类型对应的$_FILES["file"]["type"](转)
  • 原文地址:https://www.cnblogs.com/lujieting/p/12466228.html
Copyright © 2011-2022 走看看