[英]error 'No route found' Symfony PHP
我有這個錯誤:
[2016-05-12 23:33:48] request.ERROR:未捕獲的PHP異常Symfony \\ Component \\ HttpKernel \\ Exception \\ NotFoundHttpException:“在/ membri / letsolveit / vendor /”找不到“GET / lucky / number2”的路由symfony / symfony / src / Symfony / Component / HttpKernel / EventListener / RouterListener.php第123行{“exception”:“[object](Symfony \\ Component \\ HttpKernel \\ Exception \\ NotFoundHttpException(code:0):找不到\\”的路由GET / lucky / number2 \\“at /membri/letsolveit/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php:123,symfony \\ Component \\ Routing \\ Exception \\ ResourceNotFoundException(code:0): at /membri/letsolveit/var/cache/prod/appProdUrlMatcher.php:39)“} []
如果代碼在我的本地機器中完美運行,怎么可能?
這是我的控制器代碼:
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class testController2 extends Controller
{
/**
* @Route("/lucky/number2")
*/
public function numberAction() {
return new Response('<html><body>Result: test</body></html>');
}
}
這些是路由文件:
routing_dev.yml:
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
_main:
resource: routing.yml
routing.yml中:
app:
resource: "@AppBundle/Controller/"
type: annotation
問題是什么?
謝謝
問題解決了:我刪除了緩存文件夾,現在它完美無缺!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.