Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 网站搜索不工作-分析错误:语法错误,意外'=';,应为';)';_Php_Wordpress - Fatal编程技术网

Php 网站搜索不工作-分析错误:语法错误,意外'=';,应为';)';

Php 网站搜索不工作-分析错误:语法错误,意外'=';,应为';)';,php,wordpress,Php,Wordpress,我无法修复网站上的搜索功能 我在第124行的/wp content/themes/freetheme/content-execrpt.php中得到一个错误,上面写着“解析错误:语法错误,意外的“=”,预期的“')” 我查找了第24行,找到了这个函数 if (!empty($dt = theme_get_date())) { ?> <div class="date_posted_block">

我无法修复网站上的搜索功能

我在第124行的/wp content/themes/freetheme/content-execrpt.php中得到一个错误,上面写着“解析错误:语法错误,意外的“=”,预期的“')”

我查找了第24行,找到了这个函数

        if (!empty($dt = theme_get_date())) {
            ?>
            <div class="date_posted_block">
                <span class="date_posted">
                    <?php echo wp_kses_data($dt); ?>
                </span>
            </div>
if(!empty($dt=theme\u get\u date())){
?>

看起来像是右行的赋值语法。
empty()
中的赋值语法似乎无效

我测试如下:

function foo() {}
if( empty( $bar = foo() ) ) { 
   echo "empty"; 
} else { 
   echo "not empty"; 
}
得到了同样的错误。这意味着你需要改变

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


这是第124行,不是24行。错误是第*1*24行,你说你发布了第24行。这是问题中的一个打字错误还是你得到了错误的一行?对不起,这是问题中的一种类型:)谢谢你的回答这是我按照你的建议修改代码后得到的结果:解析错误:语法错误,意外的“如果”(T_-if)抱歉,第一行后的分号没有找到。将编辑答案
$dt = theme_get_date();
if (!empty($dt)) {