一、MVC介绍
Model 模型:是应用程序用于处理数据逻辑部分,通常模型对象负责在数据库中存取数据。
View 视图:处理数据显示部分
Controller 控制器:处理用户交互部分
安装laravel要求:
php>=7.1.3 pdo mbstring..等查看官网手册
win平台进入cmd 进入盘符目录下:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
二、Laravel安装
安装laravel方式一:使用composer
composer create-project --prefer-dist laravel/laravel blog
安装laravle方式二:
1、使用laravel安装器
composer global require "laravel/installer"
2、new一个laravel框架
laravel new blog
三、配置虚拟域名
nginx 配置虚拟域名:
server { listen 80; server_name www.maitian.com; #charset koi8-r; #access_log logs/host.access.log main; root "F:/PHP/Laravel5.6/PHPTutorial/WWW/laravel5.6/demo1/public"; location / { index index.html index.htm index.php l.php; autoindex off; #隐藏入口文件 try_files $uri $uri/ /index.php?$query_string; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; # } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php(.*)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
apache配置:
<VirtualHost *:80> # ... DocumentRoot /Library/WebServer/Documents/bjyblog/public # ... </VirtualHost>
配置后就可以通过www.maitian.com进行访问了