Home > Backend Development > PHP Tutorial > Laravel 4 installation and getting started graphic tutorial, laravel graphic_PHP tutorial

Laravel 4 installation and getting started graphic tutorial, laravel graphic_PHP tutorial

WBOY
Release: 2016-07-13 10:15:41
Original
938 people have browsed it

Laravel 4 installation and getting started graphic tutorial, laravel graphic tutorial

1. Install Composer

First you need to install Composer. Composer is a PHP dependency management tool. The Laravel framework uses Composer to perform installation and dependency management.
Note:
(1) If there is an error when installing Composer, enable php_openssl and php_fileinfo extensions in php.ini because Laravel requires them.
(2) During the installation process, select the correct php.exe location

2. Install Laravel

After Composer is installed, in cmd, execute the following command in your website directory:

<ol class="linenums"><li class="L0">composer create-project laravel/laravel your-project-name</li></ol>
Copy after login


Composer will automatically download and install Laravel for you.


3. Deploy virtual host

For example, my project name is project:

<ol class="linenums">
<li class="L0"><VirtualHost *:80></li>
<li class="L1">DocumentRoot "E:/www/project/public"</li>
<li class="L2">ServerName laravel.dev</li>
<li class="L3">ErrorLog "logs/laravel.log"</li>
<li class="L4">CustomLog "logs/laravel.log" common</li>
<li class="L5"></VirtualHost></li>
</ol>
Copy after login


Of course, you also need to bind the domain name in your hosts:

<ol class="linenums"><li class="L0">127.0.0.1    laravel.dev</li></ol>
Copy after login


At this point, the installation is complete:

4. Implement Hello World

Printing Hello World through routing, add in app/routes.php:

<ol class="linenums">
<li class="L0">Route::get('test', function()</li>
<li class="L1">{</li>
<li class="L2">return 'Hello World!';</li>
<li class="L3">});</li>
</ol>
Copy after login

Because the Laravel template uses Blade, the Controller or view will be introduced in later tutorials!

When Laravel 41 performs database save(), two more fields, updated_at and created_at, will automatically appear. How to cancel?

By default, Eloquent will automatically maintain created_at and updated_at fields in the data table. Simply add these timestamp fields to the table and Eloquent will do the rest for you. If you don't want Eloquent to maintain these fields, add the following property to your model: public $timestamps = false;

Reference: www.golaravel.com/docs/4.1/eloquent/#timestamps

How to check the sessionID of laravel4

It is recommended that you install debugbar and require the following in composer.json:
"barryvdh/laravel-debugbar": "1.*"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/902778.htmlTechArticleLaravel 4 installation and getting started graphic tutorial, laravel graphic 1. Install Composer First you need to install Composer, Composer is PHP dependency management tool, the Laravel framework uses Composer to perform installation...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template