HTML:
Controller:
Page error:
Then, I just need to redefine a variable, like this
Controller:
So, I don’t understand why laravel makes an error when assigning created_at or updated_time in the controller.
Help Me!
漂亮男人2017-05-16 13:19:08
The system classifies created_at
、updated_at
、deleted_at
字段格式化为了CarbonCarbon
.
// 例子
$posts->created_at->timestamp; // 时间戳
$posts->created_at->format('Y-m-d H:i:s'); // 返回指定格式
// Carbon支持很多操作
About
CarbonCarbon
的了解,可访问官网:http://carbon.nesbot.com/ (绝对推荐使用
)
某草草2017-05-16 13:19:08
要用Carbon
$post->updated_time = Carbon::now();
$post->updated_time = Carbon::parse('2017-01-01');
$post->updated_time = Carbon::createFromTimestamp(1491747387);