/**
* 时间日期字段格式化处理
* @access public
* @param mixed $time 时间日期表达式
* @param mixed $format 日期格式
* @param bool $timestamp 是否进行时间戳转换
* @return mixed
*/
protected function formatDateTime($time, $format, $timestamp = false)
{
if (false !== strpos($format, '\\')) {
$time = new $format($time);
} elseif (!$timestamp && false !== $format) {
$time = date($format, $time);
}
return $time;
}参数描述中$timestamp是用于标识是否进行时间戳转换的,那为什么elseif中对于$timestamp为假的反倒进行格式转化呢?最佳答案