substr("2022-10-11",0,10) //截取字符串
number_format(1234.5678,2) //保留两位小数
array_push($arr,$info) //数组叠加
array_merge($arr,$info) //数组合并
time() //获取时间戳
//laravel Carbon
Carbon::now() //获取当前日期和时间
Carbon::today() //当天日期和时间
Carbon::now()->startOfMonth() //当前月份的第一天
Carbon::now()->endOfMonth() //当前月份的最后一天
Carbon::now()->subWeek(0)->startOfWeek() //当周的第一天
Carbon::now()->subWeek(0)->endOfWeek(); //当周的最后一天
//laravel SQL
->select(['id','user'])
->insert([
"consumption_total" => $consumption_total,
])
->update([
"consumption_total" => $consumption_total,
])
->delete()
->where('column_name','=','1')
->where('column_name',like,"%".'1'."%")
->first()
->find()
->get()
->orderBy('name', 'desc') //排序 asc 或 desc
->groupBy('column_name') // 根据所选字段分组,注意字段的类型必须是字符串
->get()->toArray() //转化为数组
->count() //总数
//时间戳转YYYY-mm-dd
let time = '时间戳';
let year = new Date(end_date).getFullYear()
let month = new Date(end_date).getMonth()+1
let day = new Date(new Date(year,month).setDate(0)).getDate();
let time_process = year+'-'+month+'-'+day;
本文链接:https://www.cution.cn/39.html