Model类中formatDateTime方法的问题

浏览:1604 发布日期:2017/05/06 分类:求助交流
/**
     * 时间日期字段格式化处理
     * @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为假的反倒进行格式转化呢?
最佳答案
评论( 相关
后面还有条评论,点击查看>>