继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

symfony-url(annotations)

慕前端9063831
关注TA
已关注
手记 1
粉丝 0
获赞 0

symfony 3.1.1 requirements

<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
   /* public function indexAction(Request $request)
    {
        // replace this example code with whatever you need
        return $this->render('default/index.html.twig', [
            'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
        ]);
    }*/

    /**
     * @Route("/wr/{name}",defaults={"name":1},requirements={"name"="\d+"})
     * @Template("default/wr.html.twig")
     */
    public function wrAction($name)
    {
        return array('name' => $name);
    }
}
打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP