gpt4 book ai didi

php - Laravel html_entity_decode 使用 UTF-8

转载 作者:行者123 更新时间:2023-12-05 02:23:02 24 4
gpt4 key购买 nike

我正在使用 Laravel 4,以及 PHP 和 MySQL。一切都在 UTF-8 中

我的数据库中存储了博客标题,如下所示:

This is an "example" post title

现在在我的网站上,我有使用 alt 的图片title属性。当我 echo我的博客标题,我得到类似的东西:

<img src="image.jpg" alt="This is an "example" post title" />

这当然很糟糕。

我尝试了以下方法:

{{ html_entity_decode($blog_title, ENT_QUOTES, 'UTF-8') }}

但是好像没什么作用。我错过了什么?

我希望标题显示如下:This is an &quot;example&quot; post title

最佳答案

我使用的是 5.7 laravel 版本。以下解决方案解决了我的问题:

<p>{!! $pa_full_desc !!}</p>

这里 $pa_full_desc 有虚拟的 html 内容,例如。

<p>In lobortis pharetra mattis. Morbi nec nibh iaculis, <a href="#">bibendum augue a</a>, ultrices nulla. Nunc velit ante, lacinia id tincidunt eget, faucibus nec nisl.</p>

这对我有用。感谢您提出这个问题。

关于php - Laravel html_entity_decode 使用 UTF-8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25643894/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com