如何将ckeditor html输出转换为普通字符串和限制字符串

问题描述 投票:1回答:1

我正在使用laravel 5.5试图限制ckeditor字符串,但它输出我像这样

我的数据库

<p> something something something something something </p>

我是这样想的

{!! substr($content,0, 20) !!}

产量

<p> something ...

并没有关闭段落,这就是为什么我的页面崩溃,并没有正常工作

我怎样才能将ckeditor字符串转换为普通字符串并限制它

谢谢

javascript php laravel ckeditor
1个回答
4
投票

使用strip_tags()

{!! strip_tags(substr($content,0, 20)) !!}
© www.soinside.com 2019 - 2024. All rights reserved.