繁体   English   中英

Symfony2 Fos Rest显示url,给出500个日志

[英]Symfony2 Fos Rest showing url , giving 500 in logs

app / console router:debug show

get_test_helloworld      GET    /test/helloworld.{_format}

但是在点击这个网址时,没有显示任何内容,而且在日志中我得到了

    [2013-06-08 02:38:44] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException:
No route found for "GET /test/helloworld" (uncaught exception) 
at /home/user/Code/app/cache/prod/classes.php line 4261 [] []

我的TestController

<?php

namespace User\Bundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\RestBundle\View\View;
use FOS\RestBundle\Response\Codes;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

class TestController extends Controller
{
    public function getTestHelloworldAction()
    {
        var_dump('hello world');die;
    }
}

我正在使用FosRest包和routing.yml

test:
    type: rest
    resource: User\Bundle\Controller\TestController

从很久以后就被困在这里了。 任何想法哪里出错了?

清除缓存并重启服务器和php。 希望这可以帮助。

你没有/ test / helloworld route的问题,你只有test / helloworld.html导致格式化,html是默认值,你没有指定id。 如果你想测试AJAX调用(例如用json格式化)和普通请求,那么就这样保留它,但是如果你只使用html格式,则删除。{_ format},因为你不需要它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM