如何回显多个div?

时间:2017-08-26 21:39:53

标签: php html css echo division

我想回复这个HTML代码,但无法解决这个问题
代码:

<div class="cbp-item <?php echo( htmlspecialchars( $row['catName'] ) ); ?>">
            <div class="cbp-caption">
                <div class="cbp-caption-defaultWrap">
                    <img src="gallery/<?php echo( htmlspecialchars( $row['gFILE_NAME'] ) ); ?>" alt="">
                </div>
                <div class="cbp-caption-activeWrap">
                    <div class="cbp-l-caption-alignCenter">
                        <div class="cbp-l-caption-body">
                            <h4>by <?php echo( htmlspecialchars( $row['picCourtesy'] ) ); ?></h4>
                            <a href="gallery/<?php echo( htmlspecialchars( $row['gFILE_NAME'] ) ); ?>" class="cbp-lightbox cbp-l-caption-buttonRight" data-title="by <?php echo( htmlspecialchars( $row['picCourtesy'] ) ); ?>">view larger</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

如何回应这一点,例如<?php echo '<div>' hellow '</div>'; ?>

2 个答案:

答案 0 :(得分:2)

echo '<div class="cbp-item '.$catName.' ">
            <div class="cbp-caption">
                <div class="cbp-caption-defaultWrap">
                    <img src="gallery/'.$gFILE_NAME.'" alt="">
                </div>
                <div class="cbp-caption-activeWrap">
                    <div class="cbp-l-caption-alignCenter">
                        <div class="cbp-l-caption-body">
                            <h4>by '.$picCourtesy.'</h4>
                            <a href="gallery/'.$gFILE_NAME.'" class="cbp-lightbox cbp-l-caption-buttonRight" data-title="by '.$picCourtesy.'">view larger</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>';
如果你试图回应div,你不需要使用<?php echo( htmlspecialchars( $row['catName'] ) ); ?>

答案 1 :(得分:1)

你这样做:<?php echo '<div>Hello</div>'; ?>

例:

<?php	
echo '<p dir=rtl id="textmsg" style="color: '.$donnees['color'].';">'.$donnees['text'].'</p>';
?>