我有这个错误:
[2016-05-12 23:33:48] request.ERROR:未捕获PHP异常Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException:“在/ membri / letsolveit找不到”GET / lucky / number2“的路由/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php line 123 {“exception”:“[object](Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException(code:0):找不到路由for /“GET / lucky / number2 \”/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
有什么问题?
由于
答案 0 :(得分:0)
问题解决了:我删除了缓存文件夹,现在它完美无缺!