加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – Drupal:如何在链接中呈现跨度?

发布时间:2020-12-13 16:18:46 所属栏目:PHP教程 来源:网络整理
导读:我想要这个结果: a href="path/to/something"This is a link! spanwith a span inside!/span/a 这会呈现一个链接: $render = array( 'link' = array( '#type' = 'link','#title' = t("This is a link!"),'#href' = "path/to/something",),); 为什么这不会
我想要这个结果:

<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','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>",'#options' => array(
        'html' => TRUE,)
  ),);

希望这有效……穆罕默德.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读