所以,3.5小时后似乎一切都好......
两页:
localhost.lo/XX /约
localhost.lo/XX /你好/(名称)
其中xx - routing.yml中描述的几个语言环境
- routing.yml
home:
resource: "@JetInformBundle/Resources/config/routing.yml"
prefix: /{_locale}
requirements:
_locale: ^en|de|ru|uk|pl$
Run Code Online (Sandbox Code Playgroud)
- JetInformBundle routing.yml
hello:
pattern: /hello/{name}
defaults: { _controller: JetInformBundle:Default:index, name: 'alexander' }
about:
pattern: /about
defaults: { _controller: JetInformBundle:Default:about }
Run Code Online (Sandbox Code Playgroud)
- DefaultController.php
<?php
namespace Jet\InformBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
public function indexAction($name, Request $request)
{
return $this->render('JetInformBundle:Default:index.html.twig',
array('name' => $name, 'matches' => $this->matchAction($request)));
}
public function aboutAction(Request $request)
{
return $this->render('JetInformBundle:Default:about.html.twig', …Run Code Online (Sandbox Code Playgroud)