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)) {
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里