douwen5584
douwen5584
2018-06-12 04:42
浏览 84
已采纳

在Laravel视图中调用未定义的函数

I have a About Us portion in my Laravel website home page. I have uploaded a huge article for About Us from admin panel which is shown in about us page. But I want to show a specific number of word for about us in home page and add read more after that. while click on read more it goes to about us page.

But I can't show specific number of words from that article in my home page.

I have use echo word_teaser_end($about_us[0]->details, 10); function but it gives error

Call to undefined function word_teaser_end() (View: E:\xampp\htdocs\OFFICE\SEN_CARE\sencare.com.bdesources\views\frontend\home\home.blade.php)

What should I do now ?

图片转代码服务由CSDN问答提供 功能建议

我的Laravel网站主页上有 About Us 部分。 我已经从管理面板上载了一篇关于关于我们的大文章,该文章显示在 about us 页面中。 但是我想在主页中为关于我们显示一个特定数量的单词,然后添加 read more 。 点击阅读更多,然后转到 about us 页面。

但我无法显示该文章的具体数量 在我的主页。

我使用 echo word_teaser_end($ about_us [0] - > details,10); 函数但是它给出了错误

调用未定义的函数word_teaser_end()(查看:E:\ xampp \ htdocs \ OFFICE \ SEN_CARE \ sencare.com.bd esources \ views \ frontend \ home \ home.blade。 php)

我现在该怎么办?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douzhuolong9886
    douzhuolong9886 2018-06-12 04:53
    已采纳

    I don't know about the word_teaser_end() as it's define function, Try str_limit() helper function which can help you to load the number of words from string

    {{ str_limit($string,'10') }}
    

    https://laravel.com/docs/5.6/helpers#method-str-limit

    点赞 评论

相关推荐