0

最后更新:

这也改变了混乱的drupal,所以我重新安装了xampp,我没有这个问题atm,我认为主题已关闭。

更新:

奇怪的是我处理了页面上显示的错误。我摆脱了这条线: : throw 0 < count($allow) ?新 MethodNotAllowedException(array_unique($allow)) : 新 ResourceNotFoundException(); [1/2] 资源未发现异常:

它似乎工作

但是当我删除 classes.php 中的第 2117 行时(elseif 所以 3 行

  elseif (is_object($controller)) {
  $repr = get_class($controller);
  }

) 在 /opt/lampp/htdocs/Symfony/app/cache/dev/classes.php 我得到一个新的错误,即使我把 elseif 放回去......

这是消息:

箍,好像出了点问题。classes.php 第 2117 行中的 1/1 FatalErrorException:解析错误:语法错误,意外的“elseif”(T_ELSEIF)

在 classes.php 行 2117


我明天开始在 Symfony2 上工作,这是我在这方面的第一次专业经验,但奇怪的是,这次我无法让它在我的 lamp/Kubuntu 上工作。

这是我尝试的方法:

下载了: Symfony_Standard_Vendors_2.6.4.zip (所以它在 zip 文件中),即 kunbutu 下载文件夹 mv Symfony ../../../var/www

这些网址不起作用:

http://localhost/Symfony/web/app_dev.php/hello/winzou http://localhost/Symfony/web/app_dev.php/hello/World

显示的两个页面的错误(除了 Get/hello/.. 的明显部分)是:错误 - 未捕获的 PHP 异常 Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /hello/winzou"" at /opt/lampp/htdocs/Symfony/app/cache/dev/classes.php 行 2017

in app/cache/dev/classes.php at line 2017  -

if ($referer = $request->headers->get('referer')) {
$message .= sprintf(' (from "%s")', $referer);
}
throw new NotFoundHttpException($message, $e);
} catch (MethodNotAllowedException $e) {
$message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), implode(', ', $e->getAllowedMethods()));
throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e);

at RouterListener ->onKernelRequest (object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
at call_user_func (array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
in vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php at line 61  +
at WrappedListener ->__invoke (object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
at call_user_func (object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
in app/cache/dev/classes.php at line 1790  +
at EventDispatcher ->doDispatch (array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent))
in app/cache/dev/classes.php at line 1723  +
at EventDispatcher ->dispatch ('kernel.request', object(GetResponseEvent))
in app/cache/dev/classes.php at line 1884  +
at ContainerAwareEventDispatcher ->dispatch ('kernel.request', object(GetResponseEvent))
in vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php at line 112  +
at TraceableEventDispatcher ->dispatch ('kernel.request', object(GetResponseEvent))
in app/bootstrap.php.cache at line 3011  +
at HttpKernel ->handleRaw (object(Request), '1')
in app/bootstrap.php.cache at line 2984  +
at HttpKernel ->handle (object(Request), '1', true)
in app/bootstrap.php.cache at line 3133  +
at ContainerAwareHttpKernel ->handle (object(Request), '1', true)
in app/bootstrap.php.cache at line 2377  +
at Kernel ->handle (object(Request))
in web/app_dev.php at line 28  +

和 :

[2/2] NotFoundHttpException:找不到“GET /hello/World”的路由 +

if ($referer = $request->headers->get('referer')) {
$message .= sprintf(' (from "%s")', $referer);
}
throw new NotFoundHttpException($message, $e);
} catch (MethodNotAllowedException $e) {
$message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), implode(', ', $e->getAllowedMethods()));
throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e);


if ($referer = $request->headers->get('referer')) {
$message .= sprintf(' (from "%s")', $referer);
}
throw new NotFoundHttpException($message, $e);
} catch (MethodNotAllowedException $e) {
$message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), implode(', ', $e->getAllowedMethods()));
throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e);

[1/2] ResourceNotFoundException:-

in app/cache/dev/appDevUrlMatcher.php at line 244  -
            }
            throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
        }
    }

它并不漂亮,但这是整个页面显示的内容:


Symfony 网站上的 Symfony 搜索 检测到异常!找不到“GET /hello/World”的路由 404 Not Found - NotFoundHttpException 1 链接异常:

ResourceNotFoundException »

[2/2] NotFoundHttpException:找不到“GET /hello/World”的路由 + [1/2] ResourceNotFoundException:+ 日志 - 1 个错误

ERROR - Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /hello/World"" at /opt/lampp/htdocs/Symfony/app/cache/dev/classes.php line 2017
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Acme\DemoBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".

堆栈跟踪(纯文本)+


所以我的猜测是更改 classes.php 的 2017 行,但要放什么?

我还按照教程的建议在 Symfony 文件夹中尝试:

chmod 777 -R 应用程序/缓存 chmod 777 -R 应用程序/日志

还是一样的问题...


app/config/routes 确实是空的,没有 routes 文件夹我应该放什么?以及我如何看到 dev 和 prod 之间的区别?

尝试设置 2 和 3 并在步骤 3 中得到这个:

[router] 当前路由 Name Method Scheme Host Path
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_purge ANY ANY ANY /_profiler/清除
_profiler_info 任意任意 /_profiler/info/{about}
_profiler_phpinfo 任意任意 /_profiler/phpinfo
_profiler_search_results 任意任意 /_profiler/{token}/search/results
_profiler 任意任意 /_profiler/{token}
_profiler_router 任意任意 /_profiler/{token}/router
_profiler_exception 任意任意 /_profiler/{token}/exception
_profiler_exception_css 任意任意 /_profiler/{token}/exception.css
_configurator_home 任意任意 /_configurator/
_configurator_step 任意任意 / _configurator/step/{index}
_configurator_final ANY ANY ANY /_configurator/final
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
主页 ANY ANY ANY /app/example
_welcome ANY ANY ANY /
_demo_login ANY ANY ANY /demo/secured /登录
_demo_security_check 任意任意 /demo/secured/login_check
_demo_logout 任意任意 /demo/secured/logout
acme_demo_secured_hello任意任意 /demo/secured/hello
_demo_secured_hello任意任意 /demo/secured/hello/{name}
_demo_secured_hello_admin任意任意 /demo /secured/hello/admin/{name}
_demo 任意任意 /demo/
_demo_hello 任意任意 /demo/hello/{name}
_demo_contact 任意任意 /demo/contact

更新:

奇怪的是我处理了页面上显示的错误。我摆脱了这条线: : throw 0 < count($allow) ?新 MethodNotAllowedException(array_unique($allow)) : 新 ResourceNotFoundException(); [1/2] 资源未发现异常:

它似乎工作

但是当我在 /opt/lampp/htdocs/Symfony/app/cache/dev/classes.php 中删除 classes.php 中的第 2117 行(elseif so 3 行)时,即使我把 elseif 放回去,我也会收到一个新错误。 .


这是消息:

箍,好像出了点问题。classes.php 第 2117 行中的 1/1 FatalErrorException:解析错误:语法错误,意外的“elseif”(T_ELSEIF)

in classes.php line 2117

由于我仅在 var/www 而不是 opt/ 中开始安装,所以我一无所知,欢迎提供任何帮助!

4

1 回答 1

0
  1. 检查你的 app/config/routes (dev 和 base)
  2. 在主文件夹运行命令app/console cache:clear测试它是否工作
  3. app/console route:debug如果列出了您的路线,则在主文件夹运行命令视图
于 2015-04-06T12:11:08.603 回答