I want to add a page to access the link for/hello
The configuration steps are as follows:
1. Add the code in the app/appkernel.php file:
public function registerBundles() {$bundles[] = new Acme\HelloBundle\AcmeHelloBundle();return $bundles;}
2.app/config/routing.yml
acme_hello: resource: "@AcmeHelloBundle/Resources/config/routing.yml" prefix: /
3.src/acme/hellobundle/resources/config/routing.yml
hello: pattern: /hello/{name} defaults: { _controller: AcmeHelloBundle:Hello:index }
4.src/acme/hellobundle/controller/hellocontroller.php
namespace Acme\HelloBundle\Controller;use Symfony\Component\HttpFoundation\Response;class HelloController { public function indexAction() { return new Response("Hello World"); }}
I almost followed the documentation steps, but there were some problems:
Writing on the document to execute a command line can create a new bundle and generate a new bundle directory under the SRC/ACME directory, my execution is as follows:
D:\xampp\php>php d:\xampp\htdocs\Symfony\app\console --namespace=Acme/HelloBundle --format=yml
No effect, so I created it manually.
Reply content:
I want to add a page to access the link for/hello
The configuration steps are as follows:
1. Add the code in the app/appkernel.php file:
public function registerBundles() {$bundles[] = new Acme\HelloBundle\AcmeHelloBundle();return $bundles;}
2.app/config/routing.yml
acme_hello: resource: "@AcmeHelloBundle/Resources/config/routing.yml" prefix: /
3.src/acme/hellobundle/resources/config/routing.yml
hello: pattern: /hello/{name} defaults: { _controller: AcmeHelloBundle:Hello:index }
4.src/acme/hellobundle/controller/hellocontroller.php
namespace Acme\HelloBundle\Controller;use Symfony\Component\HttpFoundation\Response;class HelloController { public function indexAction() { return new Response("Hello World"); }}
I almost followed the documentation steps, but there were some problems:
Writing on the document to execute a command line can create a new bundle and generate a new bundle directory under the SRC/ACME directory, my execution is as follows:
D:\xampp\php>php d:\xampp\htdocs\Symfony\app\console --namespace=Acme/HelloBundle --format=yml
No effect, so I created it manually.
I have encountered an issue that caused YML parsing errors with tab. The first problem should be that the file format is not correct. The second question is that you namespace useless. The console should be Create:bundle commands with namespace and format.
Judging from the error message, it should be @acmehellobundle/resources/config/routing.yml this file, YAML syntax is not correct, to see if it is indented or knocked out non-English spaces and so on.