dongmo8943 2018-02-11 14:02
浏览 76
已采纳

网站搜索不起作用 - 解析错误:语法错误,意外'=',期待')'[重复]

This question already has an answer here:

I am having trouble fixing the search feature on my site.

I get an error that says "Parse error: syntax error, unexpected '=', expecting ')' in /wp-content/themes/freetheme/content-excerpt.php on line 124"

I have looked for line 24 and found this function

        if (!empty($dt = theme_get_date())) {
            ?>
            <div class="date_posted_block">
                <span class="date_posted">
                    <?php echo wp_kses_data($dt); ?>
                </span>
            </div>
</div>
  • 写回答

1条回答 默认 最新

  • dongzhun1857 2018-02-11 14:12
    关注

    Looks like you have for the right line. The assignment syntax inside the empty() appears not to be valid.

    I tested as follows:

    function foo() {}
    if( empty( $bar = foo() ) ) { 
       echo "empty"; 
    } else { 
       echo "not empty"; 
    }
    

    and got the same error. What this means is you need to change

    if (!empty($dt = theme_get_date())) {
    

    to

    $dt = theme_get_date();
    if (!empty($dt)) {
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?