1

我正在尝试从查询结果中检索数据。现在我正在尝试的是,如果问题没有图像,则只输出空白,否则如果问题确实有图像,则使用图像标签输出图像。唯一的问题是它一直在输出Array

我哪里错了?

<?php foreach ($arrQuestionId as $key => $question) { ?>

    <div class='lt-container'>

        <p><?php echo htmlspecialchars($arrQuestionNo[$key]) . ": " . htmlspecialchars($arrQuestionContent[$key]); ?></p>

        <?php
//start:procedure image
        $img_result = '';
        if (empty($arrImageFile[$key])) {
            $img_result = '&nbsp;';
        } else {
            ?>

            <p>
                <img alt="<?php echo $arrImageFile[$key]; ?>" height="200" width="200" src="<?php echo $arrImageFile[$key]; ?>">
            </p>

            <?php
        }
//end:procedure image
        ?>

    </div>

<?php } ?>
4

1 回答 1

3
<p>
<?php foreach ($arrImageFile[$key] as $i) { ?>
    <img alt="<?= $i ?>" height="200" width="200" src="<?= 'ImageFiles/'.$i ?>">
<php } ?>
</p>
于 2013-02-07T05:12:47.020 回答