doujianzhi3358 2017-05-08 16:47
浏览 81
已采纳

PHP语法错误。 添加Wordpress函数时意外$ EOF

I'm getting syntax error, unexpected $EOF when adding this function to a Wordpress functions file. See anything?

function get_saturation($atts) {
 <?php    $sws = exec("awk -F\",\" '{if(NR==2) printf(\"\%.1f \
\",($10/8.4)*100 )}'  https://website.org/data/lastrec.csv", $retval);
      echo   $sws . " percent saturation<br>";    ?>
}
add_shortcode('saturation', 'get_saturation');
  • 写回答

1条回答 默认 最新

  • drmticpet66231422 2017-05-08 16:55
    关注

    You have opening and closing PHP tags in the wrong places (within the function, i.e. before $sws)

     function get_saturation($atts) {
      $sws = exec("awk -F\",\" '{if(NR==2) printf(\"\%.1f \
    \",($10/8.4)*100 )}'  https://website.org/data/lastrec.csv", $retval);
      echo   $sws . " percent saturation<br>"; 
    }
    add_shortcode('saturation', 'get_saturation');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了