使用div里面给表

时间:2014-11-28 06:55:38

标签: php html

我可以在这里给出的表格中使用div吗?我不能在foreach中使用div标签。

这是我的代码

<table border="1" class="table table-stripped table-bordered">
    <thead>
        <tr>
            <td></td>
            <?php foreach($tests as $test){?>
                <td><?php echo $test->name;?></td>
            <?php } ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach($tests[0]->test_attributes as $test_attribute){?>
        <tr>
            <td>
                <?php echo $test![enter image description here][1]_attribute->attribute_name;?>
            </td>
        </tr>
        <?php } ?>
    </tbody>
</table>

1 个答案:

答案 0 :(得分:1)

<table border="1" class="table table-stripped table-bordered">
    <thead>
        <tr>
            <td>&nbsp;</td>
            <?php foreach($tests as $test){?>
                <td><div><?php echo $test->name;?></div></td>
            <?php } ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach($tests[0]->test_attributes as $test_attribute){?>
        <tr>
            <td>
                <div><?php echo test_attribute->attribute_name;?></div>
            </td>
        </tr>
        <?php } ?>
    </tbody>
</table>

enter image description here