当前位置: 首页>>代码示例>>PHP>>正文


PHP time_format函数代码示例

本文整理汇总了PHP中time_format函数的典型用法代码示例。如果您正苦于以下问题:PHP time_format函数的具体用法?PHP time_format怎么用?PHP time_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了time_format函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendDetail

 function sendDetail()
 {
     if (IS_GET) {
         $map['mobile'] = I('mobile');
         $user = D('Common/shop_address')->where($map)->find();
         $map['uid'] = $user['id'];
         $orderLists = D('Order')->where($map)->order('id desc')->select();
         foreach ($orderLists as $order) {
             $result['order_id'] = $order['id'];
             $result['order_number'] = $order['order_number'];
             $result['order_date'] = time_format($order['cTime']);
             // 如果尚未付款,显示付款状态;如果已经付款,显示订单跟踪状态
             if ($order['pay_status'] != 1) {
                 $result['order_status'] = getNamebyPayStatus($order['pay_status']);
             } else {
                 $result['order_status'] = getNamebyOrderStatus($order['status_code']);
             }
             $result['status_code'] = $order['status_code'];
             $result['goods'] = json_decode($order['goods_datas'], true);
             $result['total_price'] = $order['total_price'];
             $address_info = D('Shop')->getInfo($order['address_id']);
             $result['fetch_address'] = $address_info['intro'];
             $result['fetch_contact'] = $address_info['mobile'];
             $result['id'] = $order['order_number'];
             $results[] = $result;
         }
         $this->assign('userInfo', $user);
         $this->assign('lists', $results);
         $this->display();
     }
 }
开发者ID:chenpusn,项目名称:guoxian,代码行数:31,代码来源:AdminController.class.php

示例2: Index

 public function Index()
 {
     // 获取数据
     $map['id'] = I('id');
     $info = M('Invites')->where($map)->order('id desc')->find();
     $info[startdate] = time_format($info[startdate]);
     ///拆分经纬度
     $lnglat = explode(',', $info['lnglat']);
     $info[lng] = $lnglat[0];
     $info[lat] = $lnglat[1];
     switch ($info[type]) {
         case 0:
             $info[type] = '会议';
             break;
         case 1:
             $info[type] = '聚会';
             break;
         default:
             $info[type] = '活动';
     }
     if ($info['class'] == '0') {
         $this->assign('info', $info);
         $this->display('Invites_index');
     } else {
         $this->assign('info', $info);
         $this->display('Invites_index2');
     }
 }
开发者ID:strivi,项目名称:siples,代码行数:28,代码来源:ShowController.class.php

示例3: date_time_format

function date_time_format($str)
{
    global $k;
    list($datepart, $timepart) = explode(" ", $str);
    if ($datepart . " " . $timepart == $str) {
        $df = date_format($datepart);
        $tf = time_format($timepart);
        if ($GLOBALS["debug"]) {
            echo " _{$k}_ {$df} {$tf} _ ";
        }
        if ($df and $tf) {
            return "{$df} {$tf}";
        }
    } else {
        if (preg_match('/^[0-9]+$/', $str)) {
            switch (strlen($str)) {
                case 14:
                    return "YmdHis";
                case 12:
                    return "ymdHis";
            }
        }
    }
    return false;
}
开发者ID:TaylorMonacelli,项目名称:phplib,代码行数:25,代码来源:import.php

示例4: getotherVideoList

 /**
  * 
  * 获取他人视频 ...
  */
 public function getotherVideoList()
 {
     if (!$this->input['user_id']) {
         $this->errorOutput('请输入需要查看的用户id');
     }
     //默认用户需要登陆
     $cond = " where 1 and state=1 and `user_id`=" . $this->input['user_id'];
     //用户自定义分类
     if (isset($this->input['cate_id'])) {
         $cond .= ' and cate_id=' . intval($this->input['cate_id']);
     }
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $data_limit = $cond . ' order by id desc LIMIT ' . $offset . ' , ' . $count;
     $datas = $this->obj->show($this->tbname, $data_limit, $fields = '*');
     $video_id = array();
     foreach ($datas as $k => $v) {
         $v['stateName'] = $this->settings['state'][$v['state']];
         $v['video_id'] && ($videoInfo = $this->get_video_moreinfo($v['video_id']));
         $v['m3u8'] = $videoInfo[0]['videoaddr']['default']['m3u8'];
         $v['format_duration'] = time_format($videoInfo[0]['duration']);
         $this->addItem($v);
     }
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:29,代码来源:Video.php

示例5: show

 public function show()
 {
     //查询出已经选择的视频片段
     $sql = "SELECT * FROM " . DB_PREFIX . "fast_vcr_tmp WHERE user_id = '" . $this->user['user_id'] . "' AND main_id = '" . intval($this->input['video_id']) . "' ORDER BY order_id ASC ";
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $r['duration'] = time_format(intval($r['end_time']) - intval($r['start_time']));
         $r['start_imgdata'] = '';
         $r['end_imgdata'] = '';
         $imgdata_path = FAST_EDIT_IMGDATA_PATH . $r['hash_id'];
         if (file_exists($imgdata_path . '_start.img')) {
             $r['start_imgdata'] = file_get_contents($imgdata_path . '_start.img');
         }
         if (file_exists($imgdata_path . '_end.img')) {
             $r['end_imgdata'] = file_get_contents($imgdata_path . '_end.img');
         }
         $data['videos'][] = $r;
     }
     //如果存在当前的视频,获取当前视频的信息
     if ($this->input['video_id'] && !isset($data['videos'])) {
         $this->curl->setSubmitType('post');
         $this->curl->setReturnFormat('json');
         $this->curl->initPostData();
         $this->curl->addRequestData('a', 'get_vod_info');
         $this->curl->addRequestData('id', $this->input['video_id']);
         $cur_video = $this->curl->request('vod.php');
         $data['videos'][] = $cur_video[0];
     }
     $data['main_id'] = intval($this->input['video_id']);
     $data['date_time'] = date('Y-m-d', TIMENOW);
     $this->addItem($data);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:vod_fast_edit_video.php

示例6: getList

 public function getList()
 {
     if (!extension_loaded('curl')) {
         $this->error('糗事百科插件需要开启PHP的CURL扩展');
     }
     $lists = S('QiuBai_content');
     if (!$lists) {
         $config = \Common\Controller\Addon::getConfig('QiuBai');
         $content = \Org\Net\Http::fsockopenDownload('http://www.qiushibaike.com');
         if ($content) {
             $regex = "/<div class=\"content\".*?>.*?--(.*?)--.*?<\\/div>/ism";
             preg_match_all($regex, $content, $match);
             $lists = array_map(function ($a, $b) {
                 return array('time' => time_format($a), 'content' => $b);
             }, $match[1], $match[0]);
             S('QiuBai_content', $lists, $config['cache_time']);
         }
     }
     if ($lists) {
         $this->success('成功', '', array('data' => $lists));
     } else {
         $this->error('获取糗事百科列表失败');
     }
     $this->assign('qiubai_list', $lists);
 }
开发者ID:hujun123qwe,项目名称:plover,代码行数:25,代码来源:QiuBaiController.class.php

示例7: setrunsize

 public function setrunsize()
 {
     set_time_limit(0);
     $data['size'] = get_dir_size(SITE_PATH . '/Data/cache/') / 1000 . 'k';
     $data['time'] = time();
     F('runtimecachesize', $data);
     die("{$data['size']}" . " Time:" . time_format($data['time']));
 }
开发者ID:735579768,项目名称:Ainiku,代码行数:8,代码来源:PathInfoPlugin.class.php

示例8: ticketTime

 function ticketTime()
 {
     if ($this->performance_id != 0) {
         return time_format($this->performance->time);
     } else {
         return time_format($this->season->start_time);
     }
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:8,代码来源:Ticket.php

示例9: select_videos

 public function select_videos()
 {
     $offset = intval($this->input['start']) ? intval($this->input['start']) : 0;
     $count = intval($this->input['num']) ? intval($this->input['num']) : 40;
     $limit = "  limit {$offset}, {$count}";
     $condition = $this->get_condition();
     $extend_cond = ' AND status = 2 ';
     $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE 1 " . $condition . $extend_cond . "  ORDER BY video_order_id  DESC  " . $limit;
     $q = $this->db->query($sql);
     $return = array();
     while ($r = $this->db->fetch_array($q)) {
         $r['duration_format'] = time_format($r['duration']);
         $r['totalsize'] = hg_fetch_number_format($r['totalsize'], true);
         $img_arr = $r['img_info'] = unserialize($r['img_info']);
         $r['img'] = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename'];
         $return['video_info'][] = $r;
     }
     $current_page = intval($this->input['start']);
     $page_num = 40;
     /*每页显示的数目*/
     $total_num = $this->count();
     $last_page = intval($total_num / $page_num) * $page_num;
     /*第一页*/
     $return['first_page'] = 0;
     /*下一页*/
     if ($current_page == $last_page || $current_page + $page_num == $total_num) {
         $return['next_page'] = $current_page;
     } else {
         $return['next_page'] = $current_page + $page_num;
     }
     /*前一页*/
     if ($current_page == 0) {
         $return['prev_page'] = 0;
     } else {
         $return['prev_page'] = $current_page - $page_num;
     }
     /*最后一页*/
     if (intval($total_num % $page_num) == 0) {
         $return['last_page'] = $last_page - $page_num;
     } else {
         $return['last_page'] = $last_page;
     }
     /*当前页*/
     $return['current_page'] = intval($current_page / $page_num) + 1;
     /*总页数*/
     if (intval($total_num % $page_num) == 0) {
         $return['total_page'] = intval($total_num / $page_num);
     } else {
         $return['total_page'] = intval($total_num / $page_num) + 1;
     }
     /*总条数*/
     $return['total_num'] = $total_num;
     $return['page_num'] = $page_num;
     $return['switch_mode'] = intval($this->input['g_switch_mode']);
     $this->addItem($return);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:57,代码来源:vod_get_many_videos.php

示例10: buy

 /**
  * 添加用户兑换名额记录
  * @param int $type_id
  * @param int $num
  * @return mixed
  * @author 郑钟良<zzl@ourstu.com>
  */
 public function buy($type_id = 0, $num = 0)
 {
     $invite_type = D('Ucenter/InviteType')->where(array('id' => $type_id))->find();
     $user = query_user('nickname');
     $data['content'] = "{$user} 在 " . time_format(time()) . L('_TIME_TO_BUY_') . $num . ' 个 ' . $invite_type['title'] . L('_INVITATION_');
     $data['uid'] = is_login();
     $data['invite_type'] = $type_id;
     $data['num'] = $num;
     $data['create_time'] = time();
     $result = $this->add($data);
     return $result;
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:19,代码来源:InviteBuyLogModel.class.php

示例11: get_user_attend_count

 function get_user_attend_count($gamesId, $uid = 0, $time = 0)
 {
     $map['sports_id'] = $gamesId;
     $map['token'] = get_token();
     if ($uid != 0) {
         $map['follow_id'] = $uid;
     }
     if ($time != 0) {
         $map['cTime'] = array('egt', strtotime(time_format($time, 'Y-m-d')));
     }
     $data = $this->where($map)->field('sum(count) totals')->select();
     return intval($data[0]['totals']);
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:13,代码来源:DrawFollowLogModel.class.php

示例12: detail

 public function detail()
 {
     if (!$this->input['row_id']) {
         $this->errorOutput(NOID);
     }
     //查询出顶级类别供下面没有分类的时候用
     $sql = "SELECT * FROM " . DB_PREFIX . "vod_media_node WHERE fid = 0";
     $q = $this->db->query($sql);
     $top_sorts = array();
     while ($r = $this->db->fetch_array($q)) {
         $top_sorts[$r['id']] = $r;
     }
     $sql = "SELECT f.*,s.name AS sort_name,s.color FROM " . DB_PREFIX . "vodinfo as f  left join " . DB_PREFIX . "vod_media_node as s on f.vod_sort_id = s.id  WHERE f.id = '" . intval($this->input["row_id"]) . "'";
     $arr = $this->db->query_first($sql);
     $return['subtitle'] = $arr['subtitle'];
     $return['comment'] = $arr['comment'];
     $return['keywords'] = $arr['keywords'];
     if ($arr['sort_name']) {
         $return['vod_sort_id'] = $arr['sort_name'];
         $return['vod_sort_color'] = $arr['color'];
     } else {
         $return['vod_sort_id'] = $top_sorts[$return['vod_leixing']]['name'];
         $return['vod_sort_color'] = $top_sorts[$return['vod_leixing']]['color'];
     }
     if ($return['starttime']) {
         $return['starttime'] = '(' . date('Y-m-d', $return['starttime']) . ')';
     } else {
         $return['starttime'] = '';
     }
     $return["title"] = $arr['title'];
     $return['status'] = $this->settings['video_upload_status'][0];
     $return["create_time"] = date("Y-m-d H:i", TIMENOW);
     $return["row_id"] = intval($this->input["row_id"]);
     $return['addperson'] = $arr['addperson'];
     $return['bitrate'] = $arr['bitrate'];
     $return['duration'] = time_format($arr['duration']);
     $return['bitrate_color'] = $arr['bitrate_color'];
     $img_arr = $return['img_info'] = unserialize($arr['img_info']);
     $return['img'] = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename'];
     $rgb = $r['bitrate'] / 100;
     if ($rgb < 10) {
         $return['bitrate_color'] = $this->settings['bitrate_color'][$rgb];
     } else {
         $return['bitrate_color'] = $this->settings['bitrate_color'][9];
     }
     if ($this->input['pubinfo']) {
         $return['pubinfo'] = intval($this->input['pubinfo']);
     }
     $this->addItem($return);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:51,代码来源:vod_add_newlist.php

示例13: format_post_info

function format_post_info($post_info)
{
    $formatted_post_info = array();
    $formatted_post_info["guid"] = $post_info->guid;
    $formatted_post_info["post_title"] = $post_info->post_title;
    $formatted_post_info["post_author"] = get_userdata($post_info->post_author)->display_name;
    $formatted_post_info["mantime"] = time_format($post_info->mantime);
    $formatted_post_info["visits"] = number_format($post_info->visits);
    $formatted_post_info["pageviews"] = number_format($post_info->pageviews);
    $formatted_post_info["avg_time_on_page"] = time_format($post_info->avg_time_on_page);
    $formatted_post_info["entrance_rate"] = round($post_info->entrance_rate * 100, 2) . "%";
    $formatted_post_info["exit_rate"] = round($post_info->exit_rate * 100, 2) . "%";
    return $formatted_post_info;
}
开发者ID:nquinlan,项目名称:segmented-google-analyzer,代码行数:14,代码来源:leaderboard.php

示例14: look_video

 public function look_video()
 {
     if (!$this->input['collect_id']) {
         $this->errorOutput(NOID);
     }
     //取出集合信息
     $sql = "SELECT vc.*,vs.name AS sort_name,ch.name as channel_name FROM  " . DB_PREFIX . "vod_collect as vc LEFT JOIN " . DB_PREFIX . "vod_media_node as vs ON vc.vod_sort_id = vs.id  LEFT JOIN " . DB_PREFIX . "channel as ch ON ch.id = vc.source   WHERE vc.id = '" . intval($this->input['collect_id']) . "'";
     $return['collect'] = $this->db->query_first($sql);
     $return['collect']['create_time'] = date('Y-m-d', $return['collect']['create_time']);
     $return['collect']['update_time'] = date('Y-m-d', $return['collect']['update_time']);
     //取出该集合里面的视频信息
     $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
     $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 10;
     $limit = " limit {$offset}, {$count}";
     //查询出顶级类别供下面没有分类的时候用
     $sql = "SELECT * FROM " . DB_PREFIX . "vod_media_node WHERE fid = 0";
     $q = $this->db->query($sql);
     $top_sorts = array();
     while ($r = $this->db->fetch_array($q)) {
         $top_sorts[$r['id']] = $r;
     }
     $sql = "SELECT cv.id as cid,cv.order_id,vf.*,vs.name AS sort_name,vs.color AS vod_sort_color FROM " . DB_PREFIX . "vod_collect_video as cv  LEFT JOIN  " . DB_PREFIX . "vodinfo as  vf \r\n\t\t        ON cv.video_id = vf.id  LEFT JOIN " . DB_PREFIX . "vod_media_node as vs ON vf.vod_sort_id = vs.id  WHERE cv.collect_id = '" . urldecode($this->input['collect_id']) . "' ORDER BY cv.order_id DESC " . $limit;
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         if ($r['sort_name']) {
             $r['vod_sort_id'] = $r['sort_name'];
         } else {
             $r['vod_sort_id'] = $top_sorts[$r['vod_leixing']]['name'];
             $r['vod_sort_color'] = $top_sorts[$r['vod_leixing']]['color'];
         }
         $r['vod_leixing'] = $top_sorts[$r['vod_leixing']]['name'];
         $collects = unserialize($r['collects']);
         if ($collects) {
             $r['collects'] = $collects;
         } else {
             $r['collects'] = '';
         }
         $r['img_info'] = unserialize($r['img_info']);
         $r['img'] = $r['img_info']['host'] . $r['img_info']['dir'] . '80x60/' . $r['img_info']['filepath'] . $r['img_info']['filename'];
         $r['duration'] = time_format($r['duration']);
         $r['status'] = $this->settings['video_upload_status'][$r['status']];
         $r['source'] = $this->settings['video_channel'][$r['source']];
         $r['create_time'] = date('Y-m-d h:i', $r['create_time']);
         $r['update_time'] = date('Y-m-d h:i', $r['update_time']);
         $return['collect_video'][] = $r;
     }
     $this->addItem($return);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:49,代码来源:vod_look_video.php

示例15: add_to_collect

 public function add_to_collect()
 {
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo  WHERE id in (" . urldecode($this->input['id']) . ")";
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $img_arr = unserialize($r['img_info']);
         $r['img'] = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename'];
         $r['duration'] = time_format($r['duration']);
         $return[] = $r;
     }
     $this->addItem($return);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:16,代码来源:vod_add_collect.php


注:本文中的time_format函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。