What are the ways to download and install Laravel
This article is about how to download and install Laravel. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Several methods of downloading and installing Laravel
Click to install the package to download:
Http://www.golaravel.com/download/
Github download
Https://github.com/laravel/laravel
Download the zip package directly
SourceTree Clone download
I. laravel initialization configuration
1. Check the version requirements corresponding to laravel.
2. Open the rewrite and vhost of the httpd.conf file in apache and change the none of the httpd.conf file to all
3. Configure the httpd-vhosts.conf file
DocumentRoot "c:/code/blog/" ServerName blog.hd
4. Configure the hosts file:
127.0.0.1 blog.hd
5. Enable PHP extension php.ini
Extension=php_openssl.dllextension=php_mbstring.dllextension=php_pdo_mysql.dll
Run Laravel to launch the welcome page
1. To install laravel using the download and installation method, you need to regenerate the key and change it to the project directory in the cmd command window.
Php artisan key:generate
2. Modify the default home page and pseudo-static configuration file (.htaccess)
Entry file:
Index.php under public
Or server.php under the root directory
Visit the website:
Hd.cn/public/index.php
Or hd.cn/server.php
Optimize access and change it to hd.cn.
(1) change server.php to index.php and you can access it by hd.cn.
(2) copy the pseudo-static configuration file .htaccess to the root directory at the same level as index.php.
Another way
When configuring the httpd-vhosts.conf file
DocumentRoot "c:/code/blog/" ServerName blog.hd
Modified to:
DocumentRoot "c:/code/blog/public/" ServerName blog.hd
This method is:
Configure the entry directory
Vhost file modifies apache\ conf\ extra\ httpd-vhosts.conf
ServerAdmin webmaster@dummy-host2.example.comDocumentRoot "c:/code/blog/public/" ServerName blog.hdErrortog "loqs/dummy-host2.example.com-error.log" Customlog "logs/dummy-host2.example.com-access.log" common
Note: this method is used when a stand-alone server has the permission to modify the entry file directory or the subdirectory binds the domain name.
III. Detailed explanation of laravel HTTP basic routing
1. Laravel has the following routes
Route:: get ('/ hd', function () {echo "get";}); Route:: post ('/ hd', function () {echo "post";}); Route::put ('/ hd', function () {echo "put";}); Route::delete ('/ hd', function () {echo "delete";}); Route::patch ('/ hd', function () {echo "patch":}) Route::options ('/ hd', function () {echo "options"!})
Match means to match the following route
Route::match (['get','post','patch'],' / test', function () {echo "match"!})
Any matches any route
Route::any ('/ hd', function () {echo "any"!})
2. Routing access controller
Rount::get ('/ test','IndexController@index')
Controller creation method:
Create a controller under the controller package named IndexController.php
(1), create manually