0
我正在安装Linux Web服务器上的Apigility。它是Inmotion Hosting的共享托管帐户。我正在使用https://apigility.org/documentation/intro/installation上的说明。这很容易安装,但我遇到了语法错误,我无法弄清楚。如何获得Apigility正确工作?
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/amlcon5/public_html/websites/dev/apigility/vendor/zendframework/zend-servicemanager/src/ServiceManager.php on line 281
这里是ServiceManager.php中的错误所在的函数。
/**
* Set factory
*
* @param string $name
* @param string|FactoryInterface|callable $factory
* @param bool $shared
* @return ServiceManager
* @throws Exception\InvalidArgumentException
* @throws Exception\InvalidServiceNameException
*/
public function setFactory($name, $factory, $shared = null)
{
$cName = $this->canonicalizeName($name);
if (!($factory instanceof FactoryInterface || is_string($factory) || is_callable($factory))) {
throw new Exception\InvalidArgumentException(sprintf(
'Provided factory must be the class name of a factory, callable or an instance of "%s".',
FactoryInterface::class // <--- ERROR IS HERE
));
}
if ($this->has([$cName, $name], false)) {
if ($this->allowOverride === false) {
throw new Exception\InvalidServiceNameException(sprintf(
'A service by the name or alias "%s" already exists and cannot be overridden, please use an alternate name',
$name
));
}
$this->unregisterService($cName);
}
if ($shared === null) {
$shared = $this->shareByDefault;
}
$this->factories[$cName] = $factory;
$this->shared[$cName] = (bool) $shared;
return $this;
}
我已经试过几件事情,如:使用其他方法,禁用OpCache,并回顾了配置文件重新安装。
有没有人在设置Apigility时遇到过这个问题,或者知道如何解决这个问题?