doujing3896 2015-06-25 13:10
浏览 65
已采纳

解析错误:语法错误,代码PHP中的意外“<”(WORDPRESS)[重复]

This question already has an answer here:

I have a error:

Parse error: syntax error, unexpected '<' in /home/dgsite81/public_html/dgprint/wp-content/themes/dgprint/taxonomy-product_category.php on line 197

CODE PHP:

<?php 
    $queried_object = get_queried_object(); 
    $cat_content = get_field('category_content', $queried_object);
    $imagine2= get_field('imagine2',$queried_object);                      
    $imagine3= get_field('imagine3',$queried_object);                 
    $imagine4= get_field('imagine4',$queried_object);
    $imagine5= get_field('imagine5',$queried_object);

           $fields = array("cat_content","imagine2","imagine3","imagine4","imagine5");
             <ul>  //here is the line with error 
                <?php foreach($fiedls as $value) { ?>
                    <li><?php echo $value; ?></li>
                <?php } ?>
             </ul>
?>

How can I fix this error? I did not realize what I should add parentheses and where exactly.

</div>
  • 写回答

6条回答 默认 最新

  • doutenggu4070 2015-06-25 13:14
    关注

    You are missing closing tag for php, so php automatically tries to parse it.

    Correct code:

    $fields = array("cat_content","imagine2","imagine3","imagine4","imagine5"); ?>
    <ul>  //here is the line with error
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line