简体   繁体   中英

How to display only a part of a string in laravel 5.2?

I have a description field but I only need to show 10 characters on my blade page. How can I do this?

使用str_limit,请参阅这篇文章

{{ str_limit($string, $limit = 10, $end = '...') }}

You can show a part (first 10 characters) of a string using

{{substr($myStr, 0, 10)}}

in laravel blade template.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM