美文网首页
php源码写渲染页面遍历数组

php源码写渲染页面遍历数组

作者: LauEl | 来源:发表于2019-11-30 07:53 被阅读0次
<?php
session_start();
$arr = array('log_id' => 9.0122034916306995E+18,
    'words_result_num' => 14, 'words_result' =>
        array(0 =>
            array('words' => '电脑机器码是根据电脑硬件生成的(数字0-9,字母A)'),
            1 => array('words' => '注册时候需要提供机器码,我们才能计算出注册码。',),
            2 => array('words' => '电脑机器码',),
            3 => array('words' => 'c594-6449-fsa-38eb-foc1',),
            4 => array('words' => '注册码',),
            5 => array('words' => '在线购买网址1',),
            6 => array('words' => '立即购买',),
            7 => array('words' => '也可在浏览器中输入下面的网址',),
            8 => array('words' => 'http : / / www cihf . net / buynow . htm ',),
            9 => array('words' => '在线购买网址2',),
            10 => array('words' => '立即购买',),
            11 => array('words' => 'http : / / www . cjyp net / buynow . htm ',),
            12 => array('words' => '确定',), 13 => array('words' => '取消',)
        ,)
,);
$words_result = $arr['words_result'];
$data = '';
foreach ($words_result as $key => $value) {
    $data[] = $value['words'];
}
echo '<pre>';
echo '</pre>';
$_SESSION['data'] = $data;
?>
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<div>
    <table border="1">
        <?php
        foreach ($_SESSION['data'] as $key => $v) {
            ?>
            <tr>
                <td><?php echo $v ?></td>
            </tr>
        <?php }
        ?>
    </table>
</div>
</body>
</html>

相关文章

网友评论

      本文标题:php源码写渲染页面遍历数组

      本文链接:https://www.haomeiwen.com/subject/blgnwctx.html