2015-04-06 5 views
-1

последнее обновление:Symfony2 нет маршрутов, работающих

Это изменилось перепутались Друпал тоже, так что я переустановил XAMPP, я не имею эту проблему атм, и я думаю, что тема закрыта.

UPDATE:

странно я имел дело с ошибками, показанными на страницах. Я избавился от линии:: throw 0 < count ($ allow)? new MethodNotAllowedException (array_unique ($ allow)): new ResourceNotFoundException(); [1/2] ResourceNotFoundException:

и, кажется, работает

но когда я удалил строку 2117 в classes.php (в ElseIf так 3 линии

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

) в/Opt/lampp /htdocs/Symfony/app/cache/dev/classes.php я получаю новую ошибку, даже когда я поставил ElseIf назад ...

Вот сообщение:

обручи, внешний вид как-то пошло не так. 1/1 FatalErrorException в classes.php линии 2117: Parse Error: ошибка синтаксиса, неожиданный 'ElseIf' (T_ELSEIF)

в classes.php линии 2117


Я начинаю ЗАВТРА работу на Symfony2 для моего первого профессионального опыта, но, как ни странно, на этот раз у меня проблемы с работой над моей лампой/Kubuntu.

Вот что я пытаюсь:

скачали: Symfony_Standard_Vendors_2.6.4.zip (так что в файле почтового индекса), что папка kunbutu для скачивания мВ Symfony ../../../var/www

эти адреса не работают:

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

ошибка для обеих страниц (кроме очевидной части Получить/привет/..) показан: ОШИБКА - Непринятое исключение PHP Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException: «Не найден маршрут для« GET/hello/winzou »на странице /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/привет/Мир" +

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/привет/World" 404 Not Found - NotFoundHttpException 1 связаны Исключение:

ResourceNotFoundException » 

[2/2] NotFoundHttpException: Нет маршрута найдено "GET/привет/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". 

Трассировка стека (обычный текст) +


Так что я предполагаю изменить строку 2017 классов.php, но что положить?

Я также попробовать в папке Symfony как это было предложено в учебнике:

CHMOD 777 -R приложения/кэш CHMOD 777 -R приложения/журналы

Еще же проблема ...


Приложение/config/routes действительно пустое, нет папки маршрутов, что я должен поставить? и как я вижу разницу между dev и prod?

Попробуйте установить 2 и 3, и получил это в шаге 3:

[маршрутизатор] Текущие маршруты Имя метода Схема хоста Путь
_wdt ANY ANY ANY/_wdt/{маркер}
_profiler_home Любые/_profiler/
_profiler_search Любой/_profiler/поиск
_profiler_search_bar Любой/_profiler/search_bar
_profiler_purge Любой/_profiler/продуть
_profiler_info Любого/_profiler/Информация/{о}
_profiler_phpinfo ANY ANY ANY/_profiler/phpinfo
_profiler_search_results ANY ANY ANY/_profiler/{маркер}/поиск/Результаты
_profiler ANY ANY ANY/_profiler/{маркер}
_profiler_router ANY ANY ANY/_profiler/{маркер}/маршрутизатор
_profiler_exception Любые/_profiler/{маркер}/исключение
_profiler_exception_css Любые /_profiler/{token}/exception.css
_configurator_home Любые/_configurator/
_configurator_step ЛЮБОЙ ЛЮБОЙ/_configurator/step/{index}
_configurator_final ЛЮБОЙ ЛЮБОЙ ЛЮБЫЙ/_configurator/final
_twig_error_test ЛЮБОЙ ЛЮБОЙ/_error/{код}.{_format}
домашнюю ANY ANY ANY/приложение/пример
_welcome ANY ANY ANY/
_demo_login ANY ANY ANY/демо/обеспеченных/Войти
_demo_security_check ANY ANY ANY/демо/обеспеченных/login_check
_demo_logout Любые/демо/обеспеченных/выход из системы
acme_demo_secured_hello ANY ANY ANY/демо/обеспеченных/привет
_demo_secured_hello ANY ANY ANY/демо/обеспеченных/привет/{имя}
_demo_secured_hello_admin ANY ANY ANY/демо/обеспеченных/привет/админ/{ имя}
_demo ЛЮБОЙ ЛЮБОЙ/ДЕМО/
_demo_hello Любые/демо/привет/{имя}
_demo_contact Любые/демо/контакт

UPDATE:

странно я имел дело с ошибками, показанными на страницах. Я избавился от линии:: throw 0 < count ($ allow)? new MethodNotAllowedException (array_unique ($ allow)): new ResourceNotFoundException(); [1/2] ResourceNotFoundException:

и, кажется, работает

но когда я удалил строку 2117 в classes.php (в ElseIf так 3 линии) в/Opt/lampp/HTDOCS/Symfony/приложение/кэш /dev/classes.php я получаю новую ошибку, даже когда я поставил ElseIf назад ...


Вот сообщение:

обручи, похоже, что-то пошло не так. 1/1 FatalErrorException в classes.php линии 2117: Parse Error: ошибка синтаксиса, неожиданный 'ElseIf' (T_ELSEIF)

in classes.php line 2117 

Так как я начал установку только в вар/WWW и не выбирают/I» не знаешь, любая помощь приветствуется!

+0

Как вы регистрируете эти маршруты? Любой код? –

+0

Какой файл мне нужно отправить, чтобы дать вам код? Я сделал все по умолчанию, «hello» - это контроллер по умолчанию, установленный в symfony2 – user3595784

ответ

0
  1. Проверьте ваше приложение/Config/маршруты (Dev и база)
  2. На главной команде Папки выполнения app/console cache:clear теста, если его работой
  3. На главной команде папки запуска app/console route:debug просмотра, если указан маршрут
+0

weird Я рассматривал ошибки, указанные на страницах. Я избавился от строки: [1/2] ResourceNotFoundException: - – user3595784

+0

cd to/www/Symfony и внутри него попробуйте: php app/console cache: clear !!! Все файлы приложения/кеша являются временными, поэтому вы не должны их исправлять, поскольку они будут удалены в какой-то момент – Svetoslav