[PHP] Laravel 5.5 使用备注
laravel-5_5文档地址:
https://laravelacademy.org/category/laravel-5_5
模板变量文档:
https://laravelacademy.org/post/7888.html
Eloquent ORM
https://laravelacademy.org/post/8194.html
1、安装
composer create-project --prefer-dist laravel/laravel blog 5.5.*
2、修改为国内库
composer.json添加:
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.laravel-china.org"
}
}
3、
生成模型类
php artisan make:model Models/Test
生成控制器类
php artisan make:controller UserController
php artisan make:controller Admin/UserController
php artisan make:controller Home/UserController
4、nginx.conf配置
server {
listen 82;
server_name localhost;
charset utf-8;
index index.php;
root ***/blog/public;
location / {
index index.php;
root ***/blog/public;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
5、csrf
在form中使用:
csrf_field() 或
<input type="hidden" name="_token" value="{{ csrf_token() }}">
另: 添加csrf检测排除,在 VerifyCsrfToken 文件中添加
本博客地址: wukong1688
本文原文地址:https://www.cnblogs.com/wukong1688/p/10921555.html
转载请著名出处!谢谢~~