Answer the question
In order to leave comments, you need to log in
Creating a bundle in symfony2
1. Installed symfony2 downloaded from the office. site on denwer. ( localhost/app_dev.php/demo works)
2. I start following the instruction symfony.com/doc/2.0/book/page_creation.html .
2.1. In cmd I make a command to create a bundle:
D:\WebServers\usr\local\php5\php.exe D:\WebServers\home\akinator\www\Symfony\app\console generate:bundle --namespace=Acme/HelloBundle --format=yml
# в app/config/routing.yml
AcmeHelloBundle:
resource: "@AcmeHelloBundle/Resources/config/routing.yml"
prefix: /
# в src/Acme/HelloBundle/Resources/config/routing.yml
hello:
pattern: /hello/{name}
defaults: { _controller: AcmeHelloBundle:Hello:index }
// src/Acme/HelloBundle/Controller/HelloController.php
namespace Acme\HelloBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
class HelloController
{
public function indexAction($name)
{
return new Response('<html><body>Hello '.$name.'!</body></html>');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question