无法在写入上下文中使用函数返回值?
2022-08-30 12:33:44
我有这个代码:
public function __construct($Directory = null)
{
if ($Directory === null) {
trigger_error("Directory Must Be Set!", E_USER_ERROR);
}
if (isset($Directory)) {
if (!empty(trim($Directory))) { //Error Line
echo "test";
}
}
}
(回显用于我的调试目的。
我返回致命错误:
无法在写入上下文中使用函数返回值
根据 PHP 风暴,这返回:
变量预期
但是直接从这个问题中使用代码:
这是正确的语法,因为我过去曾使用过它...但是,在这种情况下,这会引发错误。这是为什么呢?