gpt4 book ai didi

php - Symfony 2.8.1安装后报错

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:02:30 24 4
gpt4 key购买 nike

我正在使用 Symfony 2.8.1 并在 Windows 8 上使用 WAMP Server 2Apache 2.4.2 和 PHP 5.4.3我已经成功地使用命令工具安装了 Symfony,但是当我尝试访问 url http://localhost/Symfony/web/app_dev.php/ 我收到此错误消息:

ProxyGenerator.php 第 62 行中的 FatalErrorException:解析错误:语法错误、意外的“类”(T_CLASS)、期望标识符 (T_STRING)

然后是这个错误列表:

in ProxyGenerator.php line 62
at DebugClassLoader->loadClass() in EntityManager.php line 0
at ProxyFactory->__construct() in EntityManager.php line 166
at EntityManager->__construct() in EntityManager.php line 850
at EntityManager::create() in appDevDebugProjectContainer.php line 605
at appDevDebugProjectContainer->getDoctrine_Orm_DefaultEntityManagerService() in Container.php line 312
at Container->get() in classes.php line 6695
at ManagerRegistry->getService() in classes.php line 6665
at AbstractManagerRegistry->getManagers() in DoctrineDataCollector.php line 65
at DoctrineDataCollector->collect() in Profiler.php line 218
at Profiler->collect() in ProfilerListener.php line 128
at ProfilerListener->onKernelResponse() in WrappedListener.php line 61
at call_user_func() in WrappedListener.php line 61
at WrappedListener->__invoke() in classes.php line 1853
at call_user_func() in classes.php line 1853
at EventDispatcher->doDispatch() in classes.php line 1771
at EventDispatcher->dispatch() in TraceableEventDispatcher.php line 132
at TraceableEventDispatcher->dispatch() in HttpKernel.php line 179
at HttpKernel->filterResponse() in HttpKernel.php line 161
at HttpKernel->handleRaw() in HttpKernel.php line 62
at HttpKernel->handle() in ContainerAwareHttpKernel.php line 69
at ContainerAwareHttpKernel->handle() in Kernel.php line 185
at Kernel->handle() in app_dev.php line 30
at {main}() in app_dev.php line 0

在 ProxyGenerator.php 的第 62 行:

protected $placeholders = [
'baseProxyInterface' => Proxy::class,
'additionalProperties' => '',
];

问题似乎是这样的:

Proxy::class

当我把它改成那样时:

'Doctrine\Common\Proxy\Proxy'

有效!

我想知道发生了什么,以及我所做的更改是否是真正的解决方案。

有什么想法吗?谢谢。

最佳答案

这是一个 PHP 版本问题。您至少需要 PHP 5.5

这是因为 ProxyGenerator 使用静态 class 关键字来解析类名。

因此,将您的 Wamp 服务器更新到 PHP > 5.5,您应该可以开始了!

来源: https://secure.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class

关于php - Symfony 2.8.1安装后报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34592299/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com