我创建了一个包后端/主/:
我的应用程序/routing.yml
backendmain:
resource: "@backendmainBundle/Resources/config/routing.yml"
prefix: /main
我的后端/Bundle/mainBundle/config/routing.yml:
backendmain_homepage:
pattern: /hello/{name}
defaults: { _controller: backendmainBundle:Default:index }
我的后端/Bundle/mainBundle/DefaultController.php:
namespace backend\Bundle\mainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function indexAction($name)
{
return $this->render('backendmainBundle:Default:index.html.twig', array('name' => $name));
}
public function testAction($name)
{
return $this->render('backendmainBundle:Default:test.html.twig', array());
}
}
如何在浏览器中调用动作测试?
抱歉,Fabien 在创建 Symfony2 时是否吸毒?Symfony 1.4 非常简单!