意外的“类"(T_CLASS)仅在远程(不在本地)上 [英] unexpected 'class' (T_CLASS) only on remote (not in local)

查看:70
本文介绍了意外的“类"(T_CLASS)仅在远程(不在本地)上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发CRM.

在本地,我没有问题,但是在远程(OVH)中,我收到此错误消息:

In local, I have no problem, but in remote (OVH), I have this error message :

解析错误:语法错误,/home/dubinfo/www/CRM/model/Locataire.php中意外的类"(T_CLASS),预期的标识符(T_STRING)或变量(T_VARIABLE)或"{"或"$"在第126行

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/dubinfo/www/CRM/model/Locataire.php on line 126

这是代码:

public function setVisites($visites) {
    $this->_visites = CheckTyper::isArrayOfModel($visites,
            VisiteMaisonInvestisseur::class, 'visites', __CLASS__);
}

远程主机(OVH)上的PHP版本是5.4.38

The version of PHP on remote host (OVH) is 5.4.38

推荐答案

使用class作为常量的名称仅在PHP 5.5中可用.

Using class as a name of a constant is available in PHP 5.5 only.

要获取类名,可以将VisiteMaisonInvestisseur::class替换为get_class(new VisiteMaisonInvestisseur).

To get the class name you can replace VisiteMaisonInvestisseur::class with get_class(new VisiteMaisonInvestisseur).

或更改常量的名称.例如:VisiteMaisonInvestisseur::class_name.

Or change the name of the constant. For example: VisiteMaisonInvestisseur::class_name.

这篇关于意外的“类"(T_CLASS)仅在远程(不在本地)上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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