php致命错误:Can';在写上下文中不使用方法返回值
这是php行php致命错误:Can';在写上下文中不使用方法返回值,php,Php,这是php行 if ($this->config->get('refprogram_sharing_enable') && !empty($this->config->get('refprogram_sharing_links'))) { 返回错误消息 致命错误:无法在写入上下文中使用方法返回值如果您使用的PHP版本早于5.5,则只能使用empty中的变量,而不能使用方法调用,否则它将抛出您收到的错误 解决方案是首先计算返回值,例如: $links =
if ($this->config->get('refprogram_sharing_enable') && !empty($this->config->get('refprogram_sharing_links'))) {
返回错误消息
致命错误:无法在写入上下文中使用方法返回值如果您使用的PHP版本早于5.5,则只能使用
empty
中的变量,而不能使用方法调用,否则它将抛出您收到的错误
解决方案是首先计算返回值,例如:
$links = $this->config->get('refprogram_sharing_links');
if ($this->config->get('refprogram_sharing_enable') && !empty($links)) {
根据get
方法的输出,您也可以尝试
&&$this->config->get('refprogram\u sharing\u links')!=错误
但是,如果看不到代码的其余部分,很难判断这是否可行。如果第一个变量是字符串,第二个变量是数组:
$refprogram_sharing_enable = $this->config->get('refprogram_sharing_enable');
$refprogram_sharing_links = $this->config->get('refprogram_sharing_links');
if ( $refprogram_sharing_enable!='' && !empty($refprogram_sharing_links)) {
}
这个代码似乎是好的,问题将在代码的其他部分请粘贴在这一行的代码。这一行似乎很好,所以问题必须在前后一行。