$str = '1970-01-01 08:33:32';
//将找到的保存到$match里
preg_match("/(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/", $str, $match);
/*
match【0】保存整个匹配结果
match【1】-match【6】保存每个()匹配的结果
你只要array_shift(match)就去除了第一个
*/
array_shift($match);
//for test
print_r($match);
$str = '1970-01-01 08:33:32';
$arr = preg_split('/[- :]/',$str);
print_r($arr);
用sscanf函数,可以格式化提取出来成一个数组