Install and create the first page of symfony2. Install and create the first page of symfony2. install and configure symfony21、. see symfony.cndocsbookinstallation.html. install and create the first page of symfony2 in Openyourc symfony2 in windows.
1. installation and configuration
Reference http://symfony.cn/docs/book/installation.html
Use the installation tool:
Windows
Open your command console and execute the following command:
c:\> php -r "readfile('http://symfony.com/installer');" > symfony.phar
Then, move the downloadedsymfony.pharFile to your projects directory and execute it as follows:
c:\> move symfony.phar c:\projectsc:\projects\> php symfony.phar
Create a symfony application:
Once the Symfony Installer is ready, create your first Symfony application withnewCommand:
# Linux, Mac OS X$ symfony new my_project_name# Windowsc:\> cd projects/c:\projects\> php symfony.phar new my_project_name
Run the symfony application:
Symfony leverages the internal web server provided by PHP to run applications while developing them. Therefore, running a Symfony application is a matter of browsing the project directory and executing this command:
$ cd my_project_name/$ php app/console server:run
2. Directory
/App: Cache, configuration file, log, and core configuration parameters exist;
/Bin: stores the execution files used;
/Src: Source code compiled by yourself. view files are placed in the view folder.
/Vendor: stores third-party code;
/Web/app. php: single entry file
Check configuration:
Command line d: \ symfony2.3 \ app> php check. php
Or enter http: // localhost: 8000/config. php in the browser.
3. compile a hello world page
> Php app/console generate: bundle creates a new bundle.
Controller/defacontroller Controller. php
// The value of $ name is the value of name in route {} return array ('name' => $ name); // return the value of name to view file }}
Default/index.html. twig
Hello {{ name }}!
Enter http: // localhost: 8000/app_dev.php/hi/world in the browser. the Hello world!
Http://www.bkjia.com/PHPjc/1099827.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1099827.htmlTechArticlesymfony2 install and create the first page, symfony2 first 1. install and configure reference http://symfony.cn/docs/book/installation.html use installation tool: windows system Open your c...