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


PHP zmf::time方法代码示例

本文整理汇总了PHP中zmf::time方法的典型用法代码示例。如果您正苦于以下问题:PHP zmf::time方法的具体用法?PHP zmf::time怎么用?PHP zmf::time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在zmf的用法示例。


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

示例1: formatTime

 public static function formatTime($date)
 {
     $thisyear = intval(zmf::time(NULL, 'Y'));
     $dateyear = intval(zmf::time($date, 'Y'));
     if ($thisyear - $dateyear > 0) {
         return zmf::time($date, 'Y-m-d H:i');
     }
     $thismo = intval(zmf::time(NULL, 'm'));
     $datemo = intval(zmf::time($date, 'm'));
     if ($thisyear == $dateyear && $thismo != $datemo) {
         return zmf::time($date, 'm-d H:i');
     }
     $timer = $date;
     $diff = zmf::now() - $timer;
     $thisto = intval(zmf::time(NULL, 'd'));
     $dateto = intval(zmf::time($date, 'd'));
     $day = $thisto - $dateto;
     $free = $diff % 86400;
     if ($day > 0) {
         if ($day > 7) {
             return zmf::time($date, 'n-j H:i');
         } elseif ($day == 1) {
             return "昨天 " . zmf::time($date, 'H:i');
         } elseif ($day == 2) {
             return "前天 " . zmf::time($date, 'H:i');
         } else {
             return $day . "天前";
         }
     } else {
         if ($free > 0) {
             $hour = floor($free / 3600);
             $free = $free % 3600;
             if ($hour > 0) {
                 return $hour . "小时前";
             } else {
                 if ($free > 0) {
                     $min = floor($free / 60);
                     $free = $free % 60;
                     if ($min > 0) {
                         return $min . "分钟前";
                     } else {
                         if ($free > 0) {
                             return $free . "秒前";
                         } else {
                             return '刚刚';
                         }
                     }
                 } else {
                     return '刚刚';
                 }
             }
         } else {
             return '刚刚';
         }
     }
 }
开发者ID:ph7pal,项目名称:mei,代码行数:56,代码来源:tools.php

示例2: array

        <p class="author">
            <?php 
$this->renderPartial('/common/_user', array('uid' => $data['uid'], 'uname' => $_uname, 'type' => 'l', 'lcss' => ''));
?>
            <?php 
echo Users::getUserClass($userInfo['sex']);
?>
        </p>
        <p>
            <span class="icon-calendar"></span>
            <?php 
echo zmf::time($data['startTime'], 'Y/m/d');
?>
            <span class="icon-arrow-right"></span>
            <?php 
echo zmf::time($data['endTime'], 'Y/m/d');
?>
        </p>
        <p>
            <span class="icon-map-marker"></span>
            <?php 
echo $areaInfo['title'];
?>
            <span class="icon-exchange"></span>
            <?php 
echo $toAreaInfo['title'];
?>
        </p>
        <p>
            说明:<?php 
echo zmf::filterOutput($data['content'], true);
开发者ID:ph7pal,项目名称:wedding,代码行数:31,代码来源:_view.php

示例3: long2ip

?>
:</b>
	<?php 
echo CHtml::encode($data->content);
?>
	<br />
	<b><?php 
echo CHtml::encode($data->getAttributeLabel('type'));
?>
:</b>
	<?php 
echo CHtml::encode($data->type);
?>
	<br />        
	<b><?php 
echo CHtml::encode($data->getAttributeLabel('ip'));
?>
:</b>
	<?php 
echo long2ip($data->ip);
?>
	<br />
	<b><?php 
echo CHtml::encode($data->getAttributeLabel('cTime'));
?>
:</b>
	<?php 
echo zmf::time($data->cTime);
?>
	<br />
</div>
开发者ID:ph7pal,项目名称:momo,代码行数:31,代码来源:_view.php

示例4: log

 public function log($content = '')
 {
     if (zmf::config('appRuntimeLog')) {
         if (!$content) {
             $content = '##' . zmf::time() . '===' . ('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) . PHP_EOL;
             $content .= microtime(true) - $this->startTime . PHP_EOL;
             $content .= var_export($_POST, true) . PHP_EOL;
             $content .= str_repeat('-', 40);
         }
         file_put_contents(Yii::app()->basePath . '/runtime/appTimes.txt', $content . PHP_EOL, FILE_APPEND);
     }
 }
开发者ID:ph7pal,项目名称:mei,代码行数:12,代码来源:AppApi.php

示例5: actionSitemap

    /**
     * 生成站点地图
     */
    public function actionSitemap()
    {
        if (!zmf::uid()) {
            $this->redirect(zmf::config('domain'));
        }
        $a = $_GET['a'];
        $basedir = Yii::app()->basePath . '/../attachments/sitemap/';
        zmf::createUploadDir($basedir);
        $total = Chengyu::model()->count('status=' . Posts::STATUS_PASSED);
        $perFileNum = 1000;
        //每个文件的连接数
        $now = zmf::time('', 'Y-m-d');
        $page = isset($_GET['page']) ? $_GET['page'] : 1;
        if ($a == 'indexer') {
            $dir = $basedir . 'indexer.xml';
            $str = '';
            for ($i = 1; $i <= $total / $perFileNum + 1; $i++) {
                $str .= "<sitemap><loc>http://ciyuxinjie.org/attachments/sitemap/sitemap{$i}.xml</loc><lastmod>{$now}</lastmod></sitemap>";
            }
            $content = <<<SITEMAP
<?xml version="1.0" encoding="UTF-8"?>

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{$str}</sitemapindex>

SITEMAP;
            file_put_contents($dir, $content);
            exit;
        } elseif ($a == 'create') {
            $criteria = new CDbCriteria();
            $criteria->condition = 'status=' . Posts::STATUS_PASSED;
            $criteria->select = 'id';
            $criteria->order = 'id ASC';
            $criteria->limit = $perFileNum;
            $criteria->offset = ($page - 1) * $perFileNum;
            $items = Chengyu::model()->findAll($criteria);
            if (!empty($items)) {
                foreach ($items as $v) {
                    $str .= "<url><loc>http://ciyuxinjie.org/detail/{$v['id']}</loc><lastmod>{$now}</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url>";
                }
                $dir = $basedir . "sitemap{$page}.xml";
                $content = <<<SITEMAP
<?xml version='1.0' encoding='UTF-8'?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{$str}</urlset>
SITEMAP;
                file_put_contents($dir, $content);
                $this->message(1, "正在处理{$page}页", Yii::app()->createUrl('site/sitemap', array('a' => 'create', 'page' => $page + 1)));
            } else {
                exit('well done');
            }
        } else {
            exit('不允许的操作');
        }
    }
开发者ID:ph7pal,项目名称:mei,代码行数:57,代码来源:SiteController.php

示例6: actionComment

 /**
  * 写评论
  */
 public function actionComment()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if (Yii::app()->user->isGuest) {
         $this->jsonOutPut(2, Yii::t('default', 'loginfirst'));
     } else {
         $uid = zmf::uid();
     }
     $checkInfo = UserPower::check('addComment', true);
     if (!$checkInfo['status']) {
         $this->jsonOutPut(0, $checkInfo['msg']);
     }
     $keyid = zmf::filterInput($_POST['k']);
     $to = zmf::filterInput($_POST['to']);
     $type = zmf::filterInput($_POST['t'], 't', 1);
     $content = zmf::filterInput($_POST['c'], 't', 1);
     if (!isset($type) or !in_array($type, array('attachments', 'posts', 'poipost', 'poitips', 'question', 'answer', 'yueban', 'goods'))) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if (!isset($keyid) or !is_numeric($keyid)) {
         $this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
     }
     if (!$content) {
         $this->jsonOutPut(0, '评论不能为空哦~');
     }
     $status = Posts::STATUS_PASSED;
     //判断是否应被禁止
     //        $forbidInfo = Posts::isForbidden($content, 'comment');
     //        if ($forbidInfo['status'] != Posts::STATUS_PASSED) {
     //            //todo,增加用户非法操作次数
     //            $status = Posts::STATUS_STAYCHECK;
     //        }
     //处理文本
     $filter = Posts::handleContent($content);
     $content = $filter['content'];
     if (Yii::app()->session['checkHasBadword'] == 'yes') {
         $status = Posts::STATUS_STAYCHECK;
     }
     $model = new Comments();
     $ainfo = Posts::getSimpleInfo(array('keyid' => $keyid, 'origin' => strtolower($type)));
     if (!$ainfo) {
         $this->jsonOutPut(0, Yii::t('default', 'contentnotexists'));
     }
     $toNotice = true;
     if ($ainfo['uid'] == $uid) {
         $toNotice = false;
     }
     //当为商品评论且不是回复某人时,不提醒发布商品的人
     if ($type == 'goods' && !$to) {
         $toNotice = false;
     }
     $touid = $ainfo['uid'];
     if ($to) {
         $comInfo = Posts::getSimpleInfo(array('keyid' => $to, 'origin' => 'comments'));
         if (!$comInfo || $comInfo['status'] != Posts::STATUS_PASSED) {
             $to = '';
         } elseif ($comInfo['uid'] == $uid) {
             $toNotice = false;
         } else {
             $touid = $comInfo['uid'];
             $toNotice = true;
         }
     }
     $intoData = array('logid' => $keyid, 'uid' => $uid, 'content' => $content, 'cTime' => zmf::now(), 'classify' => $type, 'platform' => $this->platform, 'tocommentid' => $to, 'status' => $status);
     unset(Yii::app()->session['checkHasBadword']);
     $model->attributes = $intoData;
     if ($model->validate()) {
         if ($model->save()) {
             if ($type == 'answer') {
                 Answer::model()->updateCounters(array('comments' => 1), 'id=:id', array(':id' => $keyid));
                 $_url = CHtml::link('查看详情', array('question/answer', 'id' => $keyid, '#' => 'pid-' . $model->id));
                 $_content = '您的回答有了新的评论,' . $_url;
             } elseif ($type == 'poitips') {
                 PoiTips::model()->updateCounters(array('comments' => 1), 'id=:id', array(':id' => $keyid));
                 $_url = CHtml::link('查看详情', array('question/answer', 'id' => $keyid, '#' => 'pid-' . $model->id));
                 $_content = '您的短评有了新的评论,' . $_url;
             } elseif ($type == 'poipost') {
                 $_url = CHtml::link('查看详情', array('poipost/view', 'id' => $keyid, '#' => 'pid-' . $model->id));
                 PoiPost::model()->updateCounters(array('comments' => 1), 'id=:id', array(':id' => $keyid));
                 $_content = '您的点评有了新的评论,' . $_url;
             } elseif ($type == 'question') {
                 $_url = CHtml::link('查看详情', array('question/view', 'id' => $keyid, '#' => 'pid-' . $model->id));
                 Question::model()->updateCounters(array('comments' => 1), 'id=:id', array(':id' => $keyid));
                 $_content = '您的提问有了新的评论,' . $_url;
             } elseif ($type == 'posts') {
                 $_url = CHtml::link('查看详情', array('posts/index', 'id' => $keyid, '#' => 'pid-' . $model->id));
                 Posts::model()->updateCounters(array('comments' => 1), 'id=:id', array(':id' => $keyid));
                 $_content = '您的文章有了新的评论,' . $_url;
             } elseif ($type == 'attachments') {
                 $_url = CHtml::link('查看详情', array('attachments/view', 'id' => $keyid, '#' => 'pid-' . $model->id));
                 Attachments::model()->updateCounters(array('comments' => 1), 'id=:id', array(':id' => $keyid));
                 $_content = '您的图片有了新的评论,' . $_url;
             } elseif ($type == 'yueban') {
                 $_url = CHtml::link('查看详情', array('yueban/index', 'areaid' => $ainfo['toAreaid'], 'year' => zmf::time($ainfo['startTime'], 'Y'), 'month' => zmf::time($ainfo['startTime'], 'm'), 'day' => zmf::time($ainfo['startTime'], 'd')));
                 Posts::updateCount($keyid, 'UserYueban', 1, 'comments');
//.........这里部分代码省略.........
开发者ID:ph7pal,项目名称:wedding,代码行数:101,代码来源:AjaxController.php


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