发布网友 发布时间:2022-04-06 00:43
共1个回答
热心网友 时间:2022-04-06 02:13
$str = '1506111213';
1、正则瘪:
echo preg_replace('/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', '\1-\2-\3 \4:\5:\6', "20{$str}00");
2、直接当数组用:
echo "20{$str[0]}{$str[1]}-{$str[2]}{$str[3]}-{$str[4]}{$str[5]} {$str[6]}{$str[7]}:{$str[8]}{$str[9]}:00";