简体   繁体   中英

Symfony3 routing not working

I have an account on codeanywhere.com where I'm starting my journey with symfony3. At my first step I have a problem with routing. Thats my controller:

<?php

namespace PracaBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class PracaController extends Controller
{
    /**
     * @Route("/praca", name="_show")
     */
    public function showAction()
    {
        return $this->render('PracaBundle:Default:praca.html.twig');
    }
}

that's what I see under ...codeanyapp.com/app_dev.php/praca

No route found for "GET ca"

在此处输入图片说明

Does anyone have an idea what the problem is? If you need more information, just let me know. Thank you for any sugestions.

Usually if you call mysite.com/praca the error message should be No route found for GET praca and not get ca .

If i were you i'd check if it works with another pattern or even just /.

In case nothing works try to access the default route of the DefaultController generated when you generate your bundle through the console.

Add this in your app/config/routing.yml :

....
praca:
    resource: "@PracaBundle/Controller/"
    type:     annotation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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