致命错误:无法在写入上下文中使用函数返回值 [英] Fatal error: Can't use function return value in write context

查看:142
本文介绍了致命错误:无法在写入上下文中使用函数返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面代码全为html,不会加载bec.错误:

the page code is all html and it wont load bec. of this error:

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

Fatal error: Can't use function return value in write context line 142

代码:

<div>
    <div class="">
        <input type="text" id="select_shelves" name="select_shelves" class="shelves_select_and_buttons" />
        <div id="shelves_menu" >
            <ul>
                <li id="li_" onclick="printValue();">option5 <= line 142 </li>
            </ul>
        </div>
    </div>
    <div class="button">
        <input type="button" onclick="dropShelves();" id="Shelves_select_button" name="Shelves_select_button" value="" class="grey_button"/>
    </div>
</div>

推荐答案

如果后面有PHP,则问题可能是通过以下方式调用函数empty($ var):

If there is some PHP behind, the problem could be calling a function empty($var) in this way:

if(empty($var = getMyVar())) { ... }

相反,您应该这样称呼:

Instead of this You should call it this way:

$var = getMyVar();
if(empty($var)) { ... }

或更佳(如降低所指出的那样)

Or better (as deceze has pointed out)

if(!getMyVar()) { ... }

问题还会导致其他类似功能(isset,is_a,is_null等).

Problem causes also other similar functions (isset, is_a, is_null, etc).

这篇关于致命错误:无法在写入上下文中使用函数返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆