<?php
function chinese_date($timestamp, $output_delimiter = ' '){
$info_arr = explode(' ',date('Y m d H i s',strtotime('now')));
return implode($output_delimiter, array_map(function($v,$k){
switch($k){
case '0':
// 处理年
return $v.'年';
case '1':
// 处理月
return $v;
default:
// 不做处理的
return $v;
break;
}
}, $info_arr, array_keys($info_arr)));
}
echo chinese_date('now','*');
- Output for 5.4.0 - 5.4.39, 5.6.7
- Parse error: syntax error, unexpected ';' (T_STRING) in /in/imrJV on line 9
Process exited with code 255. - Output for 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected T_STRING in /in/imrJV on line 9
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
- Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/imrJV on line 5
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/imrJV on line 5
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `')'' in /in/imrJV on line 5
Process exited with code 255.
preferences:
230.32 ms | 1395 KiB | 130 Q