为了账号安全,请及时绑定邮箱和手机立即绑定

我如何将 HTML 代码放入 PHP 以进行可视化作曲家插件开发?

我如何将 HTML 代码放入 PHP 以进行可视化作曲家插件开发?

PHP
HUWWW 2021-08-28 15:56:54
我试图尽可能地修改代码,但我是初学者,任何帮助将不胜感激。启动我的代码时出现致命错误。此输出有效public function renderMyBartag( $atts, $content = null ) {  extract( shortcode_atts( array(    'foo' => 'something',    'color' => '#FF0000'  ), $atts ) );  $content = wpb_js_remove_wpautop($content, true); // fix unclosed/unwanted paragraph tags in $content  $output = "<div style='color:{$color};' data-foo='${foo}'>{$content}</div>";  return $output;}这不public function renderMyBartag( $atts, $content = null ) {  extract( shortcode_atts( array(    'foo' => 'something',    'color' => '#FF0000'  ), $atts ) );  $content = wpb_js_remove_wpautop($content, true); // fix unclosed/unwanted paragraph tags in $content  $output = "<div class="container">    < class="learn-more">        <div class="circle">            <span class="icon arrow"></span>            </div>    <p class="button-text">{$foo}</p>     </button>    </div>";  return $output;}启动我的代码时出现致命错误。我只想将 html 代码嵌入到我正在创建的短代码中
查看完整描述

1 回答

?
天涯尽头无女友

TA贡献1831条经验 获得超9个赞

在您的 $output 中,用单引号替换内部双引号或转义双引号。


<?php

    $o = " 'single quoute' ";

    $o_esc = " \"escaped_doublequotes\" ";


查看完整回答
反对 回复 2021-08-28
  • 1 回答
  • 0 关注
  • 97 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信