Php 翻译Laravel中的HTML标记
我试图翻译一个包含HTML标记的字符串,但LaravelBlade以纯文本形式返回我Php 翻译Laravel中的HTML标记,php,laravel,laravel-5,laravel-blade,gettext,Php,Laravel,Laravel 5,Laravel Blade,Gettext,我试图翻译一个包含HTML标记的字符串,但LaravelBlade以纯文本形式返回我 {{ _i('The <b>%s</b> referral program is a great way to spread the word of this great service and to earn even more money with your short links! Refer friends and receive %s of their earnings for
{{ _i('The <b>%s</b> referral program is a great way to spread the word of this great service and to earn even more money with your short links! Refer friends and receive %s of their earnings for life!', 'gano.com', '20%') }}
{{{u i('s转介计划是传播这项伟大服务的一个很好的方式,可以通过您的短链接赚取更多的钱!转介朋友并获得其终身收入的%s!','gano.com','20%')}
结果:
The <b>gano.com</b> referral program is a great way to spread the word of this great service and to earn even more money with your short links! Refer friends and receive 20% of their earnings for life!
gano.com推荐计划是传播这项伟大服务的一个很好的方式,通过您的短链接可以赚取更多的钱!推荐朋友并获得其终身收入的20%!
我正在使用下面的Laravel软件包
您可以这样呈现html标记:
{!!'此文本将以粗体显示。!!}
输出:此文本将以粗体显示
Laravel使用{{}
转义标记以防止XSS攻击
但在任何情况下,您都需要呈现变量内部的html标记,您可以使用
{!!!!}
您可以尝试以下两个选项:
{!! _i('The <b>%s</b> referral program is a great way to spread the word of this great service and to earn even more money with your short links! Refer friends and receive %s of their earnings for life!', 'gano.com', '20%') !!}
{!!html_entity_decode(_i('The <b>%s</b> referral program is a great way to spread the word of this great service and to earn even more money with your short links! Refer friends and receive %s of their earnings for life!', 'gano.com', '20%'))!!}
{!!\u i(“%s推荐计划是传播这项伟大服务的一个很好的方式,可以通过您的短链接赚取更多的钱!推荐朋友并获得其终身收入的%s!”,“gano.com”,“20%”)
{!!html_entity_decode(_i('s转介计划是传播这项伟大服务的一个很好的方式,可以通过您的短链接赚取更多的钱!转介朋友并获得其终身收入的%s!','gano.com','20%')
这两种方法都很适合你