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


PHP friendlyDate函数代码示例

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


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

示例1: viewPosts

 /**
  * 查看回复
  * @author JunhaoHo
  */
 public function viewPosts()
 {
     $aid = I('aid', null);
     //更优的方法是通过SAE的KVDB实现计数,考虑到用户数较少暂且先这样做↓↓↓↓↓
     D('Activity')->updateActivityCounterByAid($aid, 'views');
     $posts = D('Post')->getPostsByAid($aid);
     $info = D('Activity')->getActivityByAid($aid, 'subject,replies,views');
     $subject = $info['subject'];
     $replies = $info['replies'];
     $views = $info['views'];
     $uids = array();
     foreach ($posts as $post) {
         $uids[] = $post['uid'];
     }
     $avatars = D('Member')->getAvatarsByUids($uids);
     foreach ($posts as &$post) {
         $post['avatar'] = $avatars[$post['uid']];
         $post['friendly_date'] = friendlyDate($post['dateline']);
     }
     $members_num = D('ActivityMember')->getMemberNumByAid($aid);
     $haspost = count($posts) ? true : false;
     $this->assign('members_num', $members_num);
     $this->assign('posts', $posts);
     $this->assign("haspost", $haspost);
     $this->assign("aid", $aid);
     $this->assign('subject', $subject);
     $this->assign('replies', $replies);
     $this->assign('views', $views);
     $this->display();
 }
开发者ID:imdaqian,项目名称:SCAP,代码行数:34,代码来源:PostController.class.php

示例2: render

 public function render($data)
 {
     $tpl_section = $data['tpl'];
     $info = $data['info'];
     $tpl_section = $this->handle($tpl_section, '{$[title]}', op_t($info['title']));
     $tpl_section = $this->handle($tpl_section, '{$[cTime]}', friendlyDate($info['create_time']));
     $tpl_section = $this->handle($tpl_section, '{$[cTimeD]}', date('n j', $info['create_time']));
     $tpl_section = $this->handle($tpl_section, '{$[url]}', U('Cat/Index/info', array('info_id' => $info['id'])));
     /*用户标签*/
     $user = query_user(array('nickname', 'avatar32', 'avatar64', 'avatar128', 'avatar256', 'space_url'), $info['uid']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar32]}', $user['avatar32']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar64]}', $user['avatar64']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar128]}', $user['avatar128']);
     $tpl_section = $this->handle($tpl_section, '{$[user_avatar256]}', $user['avatar256']);
     $tpl_section = $this->handle($tpl_section, '{$[user_nickname]}', $user['nickname']);
     $tpl_section = $this->handle($tpl_section, '{$[user_space_url]}', $user['space_url']);
     $tpl_section = $this->handle($tpl_section, '{$[user_uid]}', $user['uid']);
     /*用户标签end*/
     $tpl_section = $this->handle($tpl_section, '{$[fav_btn]}', R('FavBtn/render', array(array('info' => $info)), 'Widget'));
     $entity = D('cat_entity')->find($info['entity_id']);
     if ($entity['can_over']) {
         $tpl_section = $this->handle($tpl_section, '{$[over_time]}', date('Y-m-d', $info['over_time']));
     } else {
         $tpl_section = $this->handle($tpl_section, '{$[over_time]}', '');
     }
     return $tpl_section;
 }
开发者ID:chenyongze,项目名称:bighaha,代码行数:27,代码来源:SysTagRenderWidget.class.php

示例3: index

 /**
  * 文章管理
  */
 public function index()
 {
     $map = array();
     if ($_POST['content']) {
         $map['content'] = array('like', '%' . t($_POST['content']) . '%');
     }
     if ($_POST['explain']) {
         $map['explain'] = array('like', '%' . t($_POST['explain']) . '%');
     }
     if ($_POST['paper_id']) {
         $map['paper_id'] = intval($_POST['paper_id']);
     }
     if ($_POST['paper_section']) {
         $map['paper_section'] = intval($_POST['paper_section']);
     }
     $this->pageKeyList = array('id', 'paper_id', 'paper_section', 'content', 'explain', 'DOACTION');
     $this->pageTab[] = array('title' => '文章列表', 'tabHash' => 'index', 'url' => U('admin/PaperArticle/index'));
     $list = M('paper_section_article')->where($map)->findPage();
     foreach ($list['data'] as &$v) {
         $v['answer_time'] = friendlyDate($v['answer_time'], 'full');
         $v['DOACTION'] = '<a href="' . U('admin/PaperArticle/editArticle', array('id' => $v['id'], 'tabHash' => 'editArticle')) . '">编辑</a>';
     }
     $this->searchKey = array('paper_id', 'paper_section', 'content', 'explain');
     $this->pageButton[] = array('title' => '搜索', 'onclick' => "admin.fold('search_form')");
     $this->assign('pageTitle', '试卷文章管理');
     $this->displayList($list);
 }
开发者ID:317703064,项目名称:ssat,代码行数:30,代码来源:PaperArticleAction.class.php

示例4: show

 public function show($data)
 {
     $data['entity'] = M('store_entity')->find($data['info']['entity_id']);
     $data['data'] = M('Data')->getByInfoId($data['info']['id']);
     $data['user'] = query_user(array('nickname', 'space_url', 'avatar64', 'avatar128'), $data['info']['uid']);
     $data['user']['info_count'] = M('Goods')->where('uid=' . $data['info']['uid'])->count();
     $map['info_id'] = $data['info']['id'];
     $data['mid'] = is_login();
     $items = M('store_item')->where('good_id=' . $data['info']['id'])->select();
     $ids = getSubByKey($items, 'order_id');
     $ids_uni = array_unique($ids);
     $m_com['id'] = array('in', implode(',', $ids_uni));
     $data['info']['com'] = M('Order')->where($m_com)->findPage(10);
     foreach ($data['info']['com']['data'] as $k => &$v) {
         $data['info']['com']['data'][$k]['user'] = query_user(array('nickname', 'space_url', 'avatar64'), $v['uid']);
         $v['response_time_format'] = $v['response_time'] ? friendlyDate($v['response_time']) : '系统自动';
     }
     $this->assign($data);
     if ($data['entity']['name'] == 'shop') {
         $this->display('Widget/DefaultInfoTpl/shop');
     } elseif ($data['entity']['name'] == 'good') {
         $data['shop'] = M('Store/StoreShop')->getById($data['info']['shop_id']);
         $this->assign($data);
         $this->display('Widget/DefaultInfoTpl/good');
     } else {
         $this->display('Widget/DefaultInfoTpl/tpl');
     }
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:28,代码来源:DefaultInfoTplWidget.class.php

示例5: getHaventReadMeassageAndToasted

 /**
  * 取回全部未读,也没有提示过的信息
  * @param $uid
  * @return mixed
  */
 public function getHaventReadMeassageAndToasted($uid)
 {
     $messages = D('message')->where(array('to_uid' => $uid, 'is_read' => 0, 'last_toast' => array('neq', 0)))->order('id desc')->limit(99999)->select();
     foreach ($messages as &$v) {
         $v['ctime'] = friendlyDate($v['create_time']);
         $v['content'] = op_t($v['content']);
     }
     unset($v);
     return $messages;
 }
开发者ID:admpub,项目名称:OpenCenter,代码行数:15,代码来源:MessageModel.class.php

示例6: getHaventReadMeassageAndToasted

 public function getHaventReadMeassageAndToasted($uid)
 {
     $messages = D('message')->where('to_uid=' . $uid . ' and  is_read=0  and last_toast!=0')->order('id desc')->limit(99999)->select();
     foreach ($messages as &$v) {
         $v['ctime'] = friendlyDate($v['create_time']);
         $v['content'] = op_t($v['content']);
     }
     unset($v);
     return $messages;
 }
开发者ID:fishling,项目名称:chatPro,代码行数:10,代码来源:MessageModel.class.php

示例7: quick

 public function quick()
 {
     $files = $this->getFile($this->mPackPath);
     $list = array();
     foreach ($files as $f) {
         $info = $this->toArray(json_decode($this->read_file($this->mPackPath . '/' . $f)));
         if (!$info) {
             continue;
         }
         $file = $this->mPackPath . '/' . $info['ctime'] . '.sql';
         $info['file'] = $info['ctime'] . '.sql';
         $info['id'] = $info['ctime'];
         $info['ctime'] = friendlyDate($info['ctime']);
         $size = filesize($this->pack_sql_dir . '/' . $info['id'] . '.sql');
         if ($size / 1024 > 1) {
             $info['size'] = number_format($size * 1.0 / 1024 / 1024, 2) . 'MB';
         } else {
             $info['size'] = number_format($size * 1.0 / 1024, 2) . 'KB';
         }
         if ($info['mtime'] != 0) {
             $info['mtime'] = friendlyDate($info['mtime']);
         }
         $list[] = $info;
     }
     /*        $listBuilder = new AdminListBuilder();*/
     /*      $listBuilder->keyText('title', L('_TITLE_'))->keyText('des', L('_INTRODUCTION_'))->keyText('author', L('_AUTHOR_'))->keyText('file', L('_SQL_FILE_NAME_'))->keyText('size', L('_SQL_SIZE_'))->keyText('ctime', L('_CREATE_TIME_'))->keyText('mtime', L('_CHANGE_TIME_'))
             ->keyDoActionEdit('update/addpack?id=###', L('_EDIT_'));*/
     /*  $listBuilder->data($list);
         $listBuilder->display();
         dump($list);
         exit;*/
     /*
                     dump($fiels);
                     exit;
     
                     $db = $this->read_file($this->pack_db_path);
                     $db = json_decode($db);
                     $db = $this->toArray($db);
                     foreach ($db['packs'] as &$pack) {
                         $file = $this->pack_sql_dir . '/' . $pack['title'] . '.sql';
                         $pack['mtime'] = date('Y-m-d H:i:s', $pack['mtime']);
                         $pack['size'] = filesize($file) . ' bytes';
                     }
                     unset($pack);*/
     $this->assign('list', $list);
     $title = L('_FAST_OPERATION_');
     //渲染模板
     $this->assign('meta_title', $title);
     $this->display();
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:50,代码来源:UpdateController.class.php

示例8: index

 public function index()
 {
     $this->pageKeyList = array('id', 'img', 'url', 'ctime', 'DOACTION');
     $this->pageTab[] = array('title' => '数据列表', 'tabHash' => 'index', 'url' => U('admin/SatPublic/index'));
     $this->pageButton[] = array('title' => '添加图片', 'onclick' => "javascript:location.href='" . U('admin/SatPublic/addImg', array('tabHash' => 'addImg')) . "'");
     $list = M('sat_ad')->findPage();
     foreach ($list['data'] as &$v) {
         $v['img'] = '<img width="150" height="150" src="' . getAttachUrlByAttachId($v['img']) . '" />';
         $v['ctime'] = friendlyDate($v['ctime'], 'full');
         $v['DOACTION'] = '<a href="' . U('admin/SatPublic/editImg', array('id' => $v['id'], 'tabHash' => 'editImg')) . '">编辑</a> ' . '<a href="javascript:admin.delsatimg(' . $v['id'] . ')">删除</a>';
     }
     $this->assign('pageTitle', '铃铛广告');
     $this->displayList($list);
 }
开发者ID:317703064,项目名称:ssat,代码行数:14,代码来源:SatPublicAction.class.php

示例9: quick

 public function quick()
 {
     $files = $this->getFile($this->mPackPath);
     $list = array();
     foreach ($files as $f) {
         $info = $this->toArray(json_decode($this->read_file($this->mPackPath . '/' . $f)));
         if (!$info) {
             continue;
         }
         $file = $this->mPackPath . '/' . $info['ctime'] . '.sql';
         $info['file'] = $info['ctime'] . '.sql';
         $info['id'] = $info['ctime'];
         $info['ctime'] = friendlyDate($info['ctime']);
         $size = filesize($this->pack_sql_dir . '/' . $info['id'] . '.sql');
         if ($size / 1024 > 1) {
             $info['size'] = number_format($size * 1.0 / 1024 / 1024, 2) . 'MB';
         } else {
             $info['size'] = number_format($size * 1.0 / 1024, 2) . 'KB';
         }
         if ($info['mtime'] != 0) {
             $info['mtime'] = friendlyDate($info['mtime']);
         }
         $list[] = $info;
     }
     /*        $listBuilder = new AdminListBuilder();*/
     /*      $listBuilder->keyText('title', '标题')->keyText('des', '用途介绍')->keyText('author', '作者')->keyText('file', 'sql文件名')->keyText('size', 'sql大小')->keyText('ctime', '创建时间')->keyText('mtime', '修改时间')
             ->keyDoActionEdit('update/addpack?id=###', '编辑');*/
     /*  $listBuilder->data($list);
         $listBuilder->display();
         dump($list);
         exit;*/
     /*
                     dump($fiels);
                     exit;
     
                     $db = $this->read_file($this->pack_db_path);
                     $db = json_decode($db);
                     $db = $this->toArray($db);
                     foreach ($db['packs'] as &$pack) {
                         $file = $this->pack_sql_dir . '/' . $pack['title'] . '.sql';
                         $pack['mtime'] = date('Y-m-d H:i:s', $pack['mtime']);
                         $pack['size'] = filesize($file) . ' bytes';
                     }
                     unset($pack);*/
     $this->assign('list', $list);
     $title = '快捷操作';
     //渲染模板
     $this->assign('meta_title', $title);
     $this->display();
 }
开发者ID:fishling,项目名称:chatPro,代码行数:50,代码来源:UpdateController.class.php

示例10: confusion

 /**
  * 题目解析疑惑
  */
 public function confusion()
 {
     $map = array();
     $this->pageKeyList = array('id', 'paper_id', 'paper_section', 'topic_num', 'topic_content', 'content', 'answer', 'answer_time', 'DOACTION');
     $this->pageTab[] = array('title' => '解析疑惑列表', 'tabHash' => 'paperTestConfusion', 'url' => U('admin/PaperTest/confusion'));
     $list = M('paper_confusion')->where($map)->order('is_read desc,id')->findPage();
     foreach ($list['data'] as &$v) {
         $map['paper_id'] = $v['paper_id'];
         $map['paper_section'] = $v['paper_section'];
         $map['topic_num'] = $v['topic_num'];
         $v['topic_content'] = M('paper_article_test')->where($map)->getField('content');
         $v['answer_time'] = friendlyDate($v['answer_time'], 'full');
         $v['DOACTION'] = '<a href="javascript:void(0)" onclick="admin.addAnswer(' . $v['id'] . ')">回答</a>';
     }
     $this->assign('pageTitle', '解析疑惑');
     $this->displayList($list);
 }
开发者ID:317703064,项目名称:ssat,代码行数:20,代码来源:PaperTestAction.class.php

示例11: getComment

 /**
  * getComment
  * 获取评论数据
  * @access public
  * @return void
  */
 public function getComment()
 {
     $map['appid'] = intval($_REQUEST['appid']);
     $map['type'] = t($_REQUEST['type']);
     $list = model('GlobalComment')->where($map)->order('id ASC')->findpage(10);
     $appUid = $this->getInterFaceUid($map['type'], $map['appid']);
     foreach ($list['data'] as $key => $value) {
         $list['data'][$key]['uavatar'] = getUserSpace($value['uid'], 'null', '_blank', '{uavatar}');
         $list['data'][$key]['uspace'] = getUserSpace($value['uid'], 'null', '_blank', '{uname}');
         $list['data'][$key]['ctime'] = friendlyDate($value['cTime']);
         $list['data'][$key]['comment'] = formatComment($value['comment']);
         $list['data'][$key]['uname'] = getUserName($value['uid']);
         $list['data'][$key]['del_state'] = $appUid == $this->mid || $value['uid'] == $this->mid ? 1 : 0;
         $list['data'][$key]['userGroupIcon'] = getUserGroupIcon($value['uid']);
     }
     exit(json_encode($list));
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:23,代码来源:CommentAction.class.php

示例12: report_list

 function report_list()
 {
     $dao = D("Report");
     $data = $dao->order("cTime desc")->findPage(10);
     //dump($data["data"]);
     echo "<table>";
     echo "<tr>";
     echo "<td>举报人</td>";
     echo "<td>链接</td>";
     echo "<td>原因</td>";
     echo "<td>举报时间</td>";
     echo "</tr>";
     foreach ($data["data"] as $key => $v) {
         echo "<tr>";
         echo "<td>" . getUserName($v["uid"]) . "</td>";
         echo "<td><a href='" . $v["url"] . "'>" . getShort($v["info"], 30) . "</a></td>";
         echo "<td>" . $v["reason"] . "</td>";
         echo "<td>" . friendlyDate($v["cTime"]) . "</td>";
         echo "</tr>";
     }
     echo "</table>";
 }
开发者ID:wangping1987,项目名称:dhfriendluck,代码行数:22,代码来源:PublicAction.class.php

示例13: getTopicList

 /**
  * 当指定pid时,查询该父分类的所有子分类;否则查询所有分类
  * @param integer $pid 父分类ID
  * @return array 相应的分类列表
  */
 public function getTopicList($limit = 20, $map = array())
 {
     if (isset($_POST)) {
         /*	//搜索时用到
         			$_POST['weiba_id'] && $map['weiba_id']=intval($_POST['weiba_id']);
         			$_POST['weiba_name'] && $map['weiba_name']=array('like','%'.$_POST['weiba_name'].'%');
         			$_POST['uid'] && $map['uid']=intval($_POST['uid']);
         			$_POST['admin_uid'] && $map['admin_uid']=intval($_POST['admin_uid']);
         			$_POST['recommend'] && $map['recommend']=$_POST['recommend']==1?1:0;*/
     }
     // 查询数据
     $list = $this->where($map)->order('topic_id desc,topic_time desc')->findPage($limit);
     // 数据组装
     foreach ($list['data'] as $k => $v) {
         $list['data'][$k]['weiba_name'] = '<a target="_blank" href="' . U('weiba/Index/detail', array('weiba_id' => $v['weiba_id'])) . '">' . $v['weiba_name'] . '</a>';
         $create_uid = model('User')->getUserInfoByUids($v['topic_uid']);
         $list['data'][$k]['topic_uid'] = $create_uid[$v['topic_uid']]['space_link'];
         $list['data'][$k]['topic_time'] = friendlyDate($v['topic_time']);
         $list['data'][$k]['DOACTION'] = '<a href="' . U('bboard/Admin/editTopic', array('topic_id' => $v['topic_id'], 'tabHash' => 'editTopic')) . '">编辑</a>|<a onclick="admin.delTopic(' . $v['topic_id'] . ');" href="javascript:void(0)">删除</a>';
     }
     return $list;
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:27,代码来源:TopicModel.class.php

示例14: getPostList

 /**
  * 获取帖子列表,后台可以根据条件查询
  * @param integer $limit 结果集数目,默认为20
  * @param array $map 查询条件
  * @return array 微吧列表信息
  */
 public function getPostList($limit = 20, $map = array())
 {
     if (isset($_POST)) {
         //搜索时用到
         $_POST['post_id'] && ($map['post_id'] = intval($_POST['post_id']));
         $_POST['title'] && ($map['title'] = array('like', '%' . $_POST['title'] . '%'));
         $_POST['post_uid'] && ($map['post_uid'] = intval($_POST['post_uid']));
         $_POST['recommend'] && ($map['recommend'] = $_POST['recommend'] == 1 ? 1 : 0);
         $_POST['digest'] && ($map['digest'] = $_POST['digest'] == 1 ? 1 : 0);
         $_POST['top'] && ($map['top'] = $_POST['top'] == 1 ? 1 : 0);
         $_POST['weiba_id'] && ($map['weiba_id'] = intval($_POST['weiba_id']));
     }
     // 查询数据
     $list = D('weiba_post')->where($map)->order('last_reply_time desc,post_time desc')->findPage($limit);
     // 数据组装
     foreach ($list['data'] as $k => $v) {
         $list['data'][$k]['title'] = '<a target="_blank" href="' . U('weiba/Index/postDetail', array('post_id' => $v['post_id'])) . '">' . $v['title'] . '</a>';
         $author = model('User')->getUserInfoByUids($v['post_uid']);
         $list['data'][$k]['post_uid'] = $author[$v['post_uid']]['space_link'];
         $list['data'][$k]['post_time'] = friendlyDate($v['post_time']);
         $list['data'][$k]['last_reply_time'] = friendlyDate($v['last_reply_time']);
         $list['data'][$k]['read_count/reply_count'] = $v['read_count'] . '/' . $v['reply_count'];
         $list['data'][$k]['weiba_id'] = $this->where('weiba_id=' . $v['weiba_id'])->getField('weiba_name');
         if ($v['is_del'] == 0) {
             $isRecommend = $v['recommend'] ? '取消推荐' : '推荐到首页';
             $isDigest = $v['digest'] ? '取消精华' : '设为精华';
             $isGlobalTop = $v['top'] == 2 ? '取消全局置顶' : '设为全局置顶';
             $isLocalTop = $v['top'] == 1 ? '取消吧内置顶' : '设为吧内置顶';
             $list['data'][$k]['DOACTION'] = '<a href="javascript:void(0)" onclick="admin.setPost(' . $v['post_id'] . ',1,' . $v['recommend'] . ');">' . $isRecommend . '</a>|<a href="javascript:void(0)" onclick="admin.setPost(' . $v['post_id'] . ',2,' . $v['digest'] . ')">' . $isDigest . '</a>|<a href="javascript:void(0)" onclick="admin.setPost(' . $v['post_id'] . ',3,' . $v['top'] . ',2)">' . $isGlobalTop . '</a>|<a href="javascript:void(0)" onclick="admin.setPost(' . $v['post_id'] . ',3,' . $v['top'] . ',1)">' . $isLocalTop . '</a>|<a href="' . U('weiba/Admin/editPost', array('post_id' => $v['post_id'], 'tabHash' => 'editPost')) . '">编辑</a>|<a href="javascript:void(0)" onclick="admin.doStorey(' . $v['post_id'] . ')">调整回复楼层</a>|<a href="javascript:void(0)" onclick="admin.delPost(' . $v['post_id'] . ')">删除</a>';
         } else {
             $list['data'][$k]['DOACTION'] = '<a href="javascript:void(0)" onclick="admin.recoverPost(' . $v['post_id'] . ')">还原</a>|<a href="javascript:void(0)" onclick="admin.deletePost(' . $v['post_id'] . ')">彻底删除</a>';
         }
     }
     return $list;
 }
开发者ID:naliduo,项目名称:ThinkSNS,代码行数:41,代码来源:WeibaModel.class.php

示例15: friendlyDate

								<div class='pf-description'>
										Issue Date:
								</div>
								<div class='pf-content'>
										<?php 
echo friendlyDate($res['issue_date']);
?>
								</div>
						</div>
						<div class="pf-element">
								<div class='pf-description'>
										Due Date:
								</div>
								<div class='pf-content'>
										<?php 
echo friendlyDate($res['due_date']);
?>
								</div>
						</div>
						<div class="pf-element">
								<div class='pf-description'>
										Description:
								</div>
								<div class='pf-content'>
										<?php 
echo $desc;
?>
								</div>
						</div>
						<div class="pf-element">
								<div class='pf-description'>
开发者ID:nhandyal,项目名称:Roski_Loaner,代码行数:31,代码来源:indexDetails.php


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