WordPress:致命错误:无法在第130行的写入上下文中使用函数返回值

4 php wordpress

我正在尝试使用wp_head动作将此代码添加到头部,

但我得到这个错误Fatal error: Can't use function return value in write context on line 130 行号130已打开 if ( !empty ( display_header_text() ) ) : ?>

这是我的代码

<?php
129:function _display_header_text() {
130:if ( !empty ( display_header_text() ) ) : ?>
131:<style type="text/css" id="_display_header_text">
132:    .mainHeader a img {
133:        display:none;
134:    }
135:</style>
136:<?php endif; }
137:add_action('wp_head','_display_header_text');
138:?>
139:
140:<?php
141:function _is_admin_bar_showing() {
142: if( is_admin_bar_showing() ):?>
143:<style type="text/css" id="_is_admin_bar_showing">
144:    .fixedHeader {
145:        top:32px;
146:    }
147:</style>
148:<?php endif; }
149:add_action('wp_head','_is_admin_bar_showing');
150:?>
Run Code Online (Sandbox Code Playgroud)

我的这段代码在localhost中工作正常,没有任何错误,但这是在实时服务器上发送错误.

知道这是什么意思吗?我该如何解决?

Ama*_*ali 12

这条线很可能导致错误:

if ( !empty ( display_header_text() ) ) : ?>
Run Code Online (Sandbox Code Playgroud)

作为州的文件empty():

注意:在PHP 5.5之前,empty()只支持变量; 其他任何东西都会导致解析错误.换句话说,以下方法不起作用:empty(trim($name)).相反,使用trim($name) == false.