1

皆さんこんにちは、私はこのコードを手に入れました

<?php if($this->item->params->get('itemRelatedIntrotext')): ?>
            <div class="itemRelIntrotext"><?php $new_string = substr($item->introtext, 0, 220); echo $new_string; ?></div>
            <?php endif; ?>

イントロテキストを持ってきていますが、すべてのhtmlコードを含むテキストを持っています

<p class="mmbodytext">Dentro del <strong>Plan Estratégico</strong> de la campaña y como una de las líneas de acción de la comunicación está el <strong>Marketing Online</strong>. Su función, educar una...</p>

テキストが呼び出されたら、class="mmbodytext" を削除する必要があります。

4

2 に答える 2

2

すべてのタグを簡単に削除する方法を探している場合は、strip_tags().

<?php echo substr(strip_tags($item->introtext), 0, 220); ?>

参考:strip_tags

于 2015-05-29T14:21:37.083 に答える