平常Laravel错误总结

一、laravel5.6 Call to a member function format() on stringphp

这个出如今使用模型save()或者update()的使用linux

解决:在对应得模型文件里面laravel

public function fromDateTime($value)app

{composer

return empty($value) ? $value : $this->getDateFormat();ide

}this

二、出现下面的错误,是使用create批量添加报的错编码

解决办法:在对应得模型中添加spa

protected $fillable = ['name', 'age', 'sex'];orm

三、出现如下问题

Sorry, the page you are looking for could not be found.

解决:通常是没加路由,或者路由错误,在或者就是没有模板

四、The page has expired due to inactivity.Please refresh and try again.

解决方法:{{ csrf_field() }} 表单验证

五、在linux下面app/public(若是上传文件在这个目录)/stotage 都给权限

六、使用composer下面安装第三方类库的时候出现下面问题

[RuntimeException]

/home/wwwroot/lar.simengphp.cn/vendor/psr/http-message does not exist and could not be created.

解决方法:composer dump-autoload

[ErrorException]

file_put_contents(/home/wwwroot/lar.simengphp.cn/vendor/composer/autoload_namespaces.php): failed

to open stream: Permission denied

解决方法:

以上都是linux下权限问题,项目vender没有权限

r:read就是读权限 --数字4表示

w:write就是写权限 --数字2表示

x:excute就是执行权限 --数字1表示

读、写、运行三项权限能够用数字表示,就是r=4,w=2,x=1。因此,-rw-r--r--用数字表示成644。

七、Class config does not exist in

缘由是个人.env里面的参数设置有空格。。。有空格的参数必定要用双引号包起来

八、1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `db_u

sers` add unique `users_email_unique`(`email`))

Laravel 5.4+默认使用utf8mb4字符编码,而不是以前的utf8编码。所以运行php artisan migrate 会出现以下错误:

你能够经过调用 AppServiceProvider 中的 Schema::defaultStringLength 方法来配置它

/**

* 引导任何应用程序服务。

*

* @return void

*/

public function boot()

{

Schema::defaultStringLength(191);

}

相关文章
相关标签/搜索