Laravel5.8*

validate验证返回中文提示信息

  1. GitHub方法
    安装后的目录 \vendor\caouecs\laravel-lang\src

validate验证重定向到Laravel首页=>返回JSON数据

App\Exceptions\Handler.php

Laravel5.8*_第1张图片

定义全局参数

1. /config 创建 file.php 
2. return ['id'=>'openid'];//return 数组格式的数据
3. 命令行输入 `php artisan config:cache 会在 boostrap/cache 生成 config.php
4. 使用 config('file.id')

环境问题(2020-10-14 2H)

SQLTATE[42000]: Syntax error or access violation: 1071 Specified key was too long: max key length is 1000 bytes (SQL: alter table `test` and index `test_title_index`(`title`))

Laravel5.8*_第2张图片

解决方式
`namespace AppProviders; boot() {Schema::defaultStringLength(191);}`

Laravel5.8*_第3张图片

跨域问题(2020-10-14 0.2H)

namespace App\Http\Middleware;
VerifyCsrfToken::class 新增
public function handle($request, Closure $next) {
// 使用CSRF
//return parent::handle($request, $next);
// 禁用CSRF
return $next($request);
}
相关文件 - header('access-Control-Allow-Origin:*');

Laravel5.8*_第4张图片

时区问题(2020-10-14 0.2H)

config/app.php 'timezone'=> 'PRC'

Laravel5.8*_第5张图片

Redis问题(2020-10-14 0.2H)

Uncaught Error: Class 'Redis' not found in
在php.ini扩展文件里面写入

extension=php_igbinary.dll
extension=php_redis.dll

可能有无法找到相关模块扩展 解决办法
可能有无法连接的情况(由于目标计算机积极拒绝,无法连接),桌面客户端不要连接线上redis

IP地址 修改 redis.conf/redis.windows.conf 的 bind 加入域名

你可能感兴趣的:(laravel)