V
V
Vitaly Liber2015-04-13 12:23:51
Yii
Vitaly Liber, 2015-04-13 12:23:51

How to display part of text in Yii2?

With the help of active record, using the following code - , we display the text of the post from the database. How to make Yii2 output only part of the text? For example, only 400 characters. <?= $orders->post ?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander N++, 2015-04-13
@VitalyLiber

\yii\helpers\StringHelper::truncate('Текст который нужно обрезать',150,'...');

V
vyachin, 2015-04-13
@vyachin

php.net/manual/en/function.mb-substr.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question