gpt4 book ai didi

PHP - 加粗 t 内的某些文本

转载 作者:行者123 更新时间:2023-11-28 01:44:53 28 4
gpt4 key购买 nike

$need_it_sooner = l(
t('Need it sooner? Click here'),
'need-it-sooner', array(
'attributes' => array(
'class' => array('float-right', 'button', 'button-red'),
'style' => 'float:right;',
))
);

这是我的代码,我想显示它

Need it sooner? Click here.

我能否在 t() 中轻松设置文本样式,还是我必须编写另一个大块来完成此操作?

最佳答案

在 Drupal 7 中,函数 l 将选项数组作为第三个参数。如果您向它传递选项 'html' => TRUE,它可以接受 HTML。您也可以通过函数 t 传递 HTML。所以你可以尝试这样做:

$need_it_sooner = l(
t('<strong>Need it sooner?</strong> Click here'),
'need-it-sooner', array(
'attributes' => array(
'class' => array('float-right', 'button', 'button-red'),
'style' => 'float:right;',
),
'html' => TRUE)
);

关于PHP - 加粗 t 内的某些文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50237344/

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