安装WordPress主题时出现以下错误:
解析错误:语法错误,意外'=='(T_IS_EQUAL),在第51行/home.....header.php中期待')'
这是第51行代码:
if( !empty( $onepage == 'one_page' ) || !empty($corpex_opt ['corpex_header_layout'] == '3' )){ ...
如果有人帮忙,我会很高兴。
答案 0 :(得分:0)
您使用empty
功能错误。 empty个函数只接受一个参数
它应该是这样的
if((!empty( $onepage )&&($onepage=='one_page'))
|| (!empty($corpex_opt ['corpex_header_layout'] )
&& ($corpex_opt ['corpex_header_layout']==3)) ) {
答案 1 :(得分:0)
您应该在use strict;
use warnings;
my ($code, $reg, $annotation); # these values come from somewhere...
run_cmd( compose_cmd(), $code, $reg, $annotation );
sub compose_cmd {
return "cat asdf";
}
sub run_cmd {
my ( $cmd, $code, $reg, $annotation ) = @_;
if ( $code =~ /aa/ ) {
my $cmd = "$reg $annotation";
out_log($cmd);
}
else {
my $cmd = "$reg $annotation";
out_log($cmd);
}
out_log("$cmd");
open my $fh, '<', $cmd or die $!;
# do stuff with $fh ...
}
sub out_log {
print @_;
}
将== '3'
更改为!empty($corpex_opt ['corpex_header_layout'] == '3' )