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時遇到過這個問題,或者知道如何解決這個問題?