解析错误:语法错误wordpress

Wez*_*zou -3 php wordpress wordpress-plugin

我有以下错误:

解析错误:语法错误,意外T_STRING,期待','或';' 在第64行的../public_html/wp-content/themes/nano/includes/galleri.php**

请帮助我让我的代码工作!

http://pastebin.com/B0ndywWc

有问题的代码:

<?php
    $ccfit_img_thumb = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_id() ), 'ccfit_thumb', false );
    $ccfit_img_big = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_id() ), 'ccfit_big', false );

    echo '
        <div class="col-md-4">
        <div class="inner">
        <a href="'. $ccfit_img_big[0] .'"></a>
        <img src="'. $ccfit_img_thumb[0] .'">
        <h2>'. get_the_title() .'</h2>
        <p>'. get_the_content() .'</p>
        <hr>
        <?php
          if (isset($featuredImages) && is_array($featuredImages)) {
            foreach($featuredImages as $images) {
                $thumb = $images['thumb']; // <---- line 64
                $fullImage = $images['full'];
                print ' <a class="fancybox" href="'. $fullImage .'" style="text-align:center">&laquo; Take a look &raquo;</a> ';
            }
        }
        ?>
        </div></div>';
?>
Run Code Online (Sandbox Code Playgroud)

jcs*_*nyi 5

错误实际上在第53行:

echo '
Run Code Online (Sandbox Code Playgroud)

你永远不会关闭那个引用...或者至少,你试图在一个echo语句中嵌套PHP标记.

在第64行实际发生的是第一个引用'thumb'被解释为回声的结束引用 - 导致thumb是意外的字符串.

内部<?php标签不被解释 - 它只被视为被回显的字符串的一部分.

请注意我在上面的问题中编辑的代码中的语法突出显示,并且可能会更清楚地发生了什么.

  • 这个答案是通过普通的语法高亮显示给你的.+1 (3认同)