【问题标题】:php concatenate string with html and cssphp 将字符串与 html 和 css 连接起来
【发布时间】:2014-08-16 11:06:52
【问题描述】:

我有这个 php 代码,我想在其中连接:

return '<div class="height-shortcode" style="height:"'.$myHeight.'">'.$content.'</div>';

我生成的 html 应该如下所示:

<div class="height-shortcode" style="height:10px">Hello World!!</div>

但是我无法摆脱它周围多余的双引号:

<div class="height-shortcode" style="height:"10px">Hello World!!</div>

提前感谢您的帮助。

【问题讨论】:

    标签: php html css concatenation


    【解决方案1】:

    你添加了一个额外的双引号

    return '<div class="height-shortcode" style="height:'.$myHeight.';">'.$content.'</div>';
    

    【讨论】:

      【解决方案2】:

      您在高度上添加了一个额外的引号"。很明显,这将打印一个更多的引号""您的代码应该如下所示

      return '<div class="height-shortcode" style="height:'.$myHeight.'">'.$content.'</div>';
      

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 2023-01-12
        • 1970-01-01
        • 2020-06-20
        • 2016-06-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-08-24
        • 1970-01-01
        相关资源
        最近更新 更多