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 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输