undefined method Carbon\Carbon::setLocale()错误

在加入\Carbon\Carbon::setLocale('zh');出现了下面的错误,就算在文件上面添加了

use Carbon\Carbon;

Call to undefined method Carbon\Carbon::setLocale()
JellyBool

理论上是不用添加use Carbon\Carbon;也可以的,可能是你的Carbon版本太低了,所以尝试update试试

openwrtmail

楼主把你的环境贴出来呗。@Kirits

Kirits

@openwrtmail 我的是laravel 5.0,php5.6.13,mysql5.6

JellyBool

@Kirits 这个问题解决了没有?

Kirits

@JellyBool 还没有捏?将"nesbot/carbon": “~1.14"改成"nesbot/carbon”: “~1.19"后再composer update,结果还是变成了"nesbot/carbon”: “~1.14”

JellyBool

@Kirits 额,好吧,你是在项目目录执行的composer update

Kirits

不过我想将多久之前发布的改成具体的年月日发布的,如果是这样的话怎么修改?

Kirits

@JellyBool 是的,在项目目录下composer update的

Kirits

@JellyBool 或者超过24小时之后就用日期来显示

JellyBool

@Kirits composer update都没能更新成功么?哎。。。

Kirits

@JellyBool 更新成功了,所以"nesbot/carbon": “~1.19"还是变成了"nesbot/carbon”: “~1.14”

JellyBool

@Kirits 好嘛,成功了就好。马上发第一个laravel的视频,有空看看。。

Kirits

@JellyBool 支持!!!

Kirits

@JellyBool 这里好像有个bug,你评论了一条信息给我,但是提示那里却是显示2条消息

JellyBool

@Kirits 这个是因为我回复了你,而且也是在你的帖子下面的评论,所以。。

Kirits

@JellyBool 原来是这样的意思 lol,我还去点了两次

JellyBool

对,就是这样的,我后面改善一下吧。。BTW,视频已发

Kirits

@JellyBool 哈哈,正在看了

JellyBool

好的,感谢捧场,继续探索怎么录好视频 @Kirits

Kirits

@JellyBool 这个我也没什么经验,我看看吧,如果有想法的话会评论给你的了

JellyBool

好的啊。 @Kirits

snail

我貌似曾经也遇到过这个问题,后台自己好了,没深查