gpt4 book ai didi

php - Drupal:如何在链接内呈现跨度?

转载 作者:可可西里 更新时间:2023-10-31 23:32:55 27 4
gpt4 key购买 nike

我想要这样的结果:

<a href="path/to/something">This is a link! <span>with a span inside!</span></a>


这会呈现一个链接:

$render = array(
'link' => array(
'#type' => 'link',
'#title' => t("This is a link!"),
'#href' => "path/to/something",
),
);


为什么这不会在链接内呈现跨度?

$render = array(
'link' => array(
'#type' => 'link',
'#title' => t("This is a link!"),
'#href' => "path/to/something",
'span' => array(
'#type' => 'markup',
'#markup' => ' <span>with a span inside!</span>',
),
),
);


提前致谢!

最佳答案

只需将您的代码调整为:

$render = array(
'link' => array(
'#type' => 'link',
'#title' => "<span>" . t("This is a link!") . "</span>",
'#href' => "path/to/something",
'#options' => array(
'html' => TRUE,
)
),
);

希望这能奏效......穆罕默德。

关于php - Drupal:如何在链接内呈现跨度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12945266/

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