这一行代码有什么问题?(php内部的php)

这一行代码有什么问题?(php内部的php),php,Php,我是php新手。我在WordPress站点的functions.php文件中有以下一行。我想我格式化包的方式有问题。有人能告诉我怎么了吗 $output.=”。获取_包()在拿到袋子()之后去掉分号,并在第一个跨距之后和第二个跨距之前加上演讲标记: $output .= "<span class='bag-item'>". get_the_bag() ."</span>"; $output.=''。拿着你的包(); 将分号从get\u the \u bag() $out

我是php新手。我在WordPress站点的functions.php文件中有以下一行。我想我格式化包的方式有问题。有人能告诉我怎么了吗


$output.=”。获取_包()

拿到袋子()之后去掉分号,并在第一个跨距之后和第二个跨距之前加上演讲标记:

$output .= "<span class='bag-item'>". get_the_bag() ."</span>";
$output.=''。拿着你的包();

将分号从
get\u the \u bag()

$output .= "<span class='bag-item'>". get_the_bag() ."</span>";
$output.=''。拿着你的包();
  • 您在字符串中间删除了各种连接内容和函数调用
  • 函数调用后,您终止了语句(使用
  • 你想要:

    $output .= sprintf("<span class='bag-item'>%s</span>", get_the_bag());
    
    $output.=sprintf(“%s”,获取包());
    

    $output.=''。拿着包()。"";
    
    (两者都假设
    get\u包
    返回一个HTML安全字符串。如果没有,则需要使用
    htmlspecialchars
    包装该函数调用)

  • 您在字符串中间删除了各种连接内容和函数调用
  • 函数调用后,您终止了语句(使用
  • 你想要:

    $output .= sprintf("<span class='bag-item'>%s</span>", get_the_bag());
    
    $output.=sprintf(“%s”,获取包());
    

    $output.=''。拿着包()。"";
    
    (都假设
    get\u theu\u bag
    返回一个HTML安全字符串。如果不返回,则需要使用
    htmlspecialchars
    包装该函数调用)。

    试试这个
    $output.=''。拿着包()。"";
    
    试试这个
    $output.=''。拿着包()。"";