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


PHP getTime函数代码示例

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


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

示例1: getSearch

 public static function getSearch($input = array())
 {
     $result = Product::where(function ($query) use($input) {
         if (!empty($input['category_id'])) {
             $query = $query->where('category_id', $input['category_id']);
         }
         if (!empty($input['type_id'])) {
             $query = $query->where('type_id', $input['type_id']);
         }
         if (!empty($input['price_id'])) {
             $query = $query->where('price_id', $input['price_id']);
         }
         if (!empty($input['time_id'])) {
             $inputDate = getTime($input['time_id']);
             $query = $query->where('start_time', '>=', $inputDate);
         }
         if (!empty($input['city_id'])) {
             $query = $query->where('city_id', $input['city_id']);
         }
         if (!empty($input['city'])) {
             $query = $query->where('city', $input['city']);
         }
         if (!empty($input['name'])) {
             $query = $query->where('name', 'like', '%' . $input['name'] . '%');
         }
         //lat long
         $query = $query->where('status', ACTIVE);
     })->select(listFieldProduct())->get();
     foreach ($result as $key => $value) {
         $value->avatar = url(PRODUCT_UPLOAD . '/' . $value->user_id . '/' . Product::find($value->id)->avatar);
         $value->block = Common::checkBlackList(Input::get('user_id'), $value->user_id);
     }
     return $result;
 }
开发者ID:trantung,项目名称:online_market,代码行数:34,代码来源:CommonSearch.php

示例2: runProducer

function runProducer()
{
    //读取FTP的下载的xml源文件列表
    $kmlPath = '/home/webdata/xml';
    $xml_file = getFileList($kmlPath);
    if (empty($xml_file)) {
        echo date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty.", PHP_EOF;
        exit;
    }
    sort($xml_file);
    $startTime = explode(' ', microtime());
    $totalNum = 0;
    $i = $n = 1;
    foreach ($xml_file as $f) {
        //解析文件生成数组
        $data = paseXml($f);
        //XML格式检查
        $res = isFormat($data, $f);
        if ($res === false) {
            continue;
        }
        //格式化
        $kmldata = formatKmlData($data, $f);
        $i++;
        $fNum = count($kmldata);
        $totalNum += $fNum;
        //入队列
        $kafkaTime = explode(' ', microtime());
        echo $i . '>>>' . $f . ',file count:' . $fNum . ',total:' . $totalNum . "/n";
        //备份文件:
        //        backFile($f);
    }
    echo 'Total time:' . getTime($startTime) . '/n';
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:34,代码来源:countxml.php

示例3: dir2array

function dir2array($dir, $content)
{
    if ($dir[strlen($dir) - 1] != '/') {
        $dir .= '/';
    }
    if (!is_dir($dir)) {
        return array();
    }
    $dir_handle = opendir($dir);
    $array = array();
    while ($object = readdir($dir_handle)) {
        if (!in_array($object, array('.', '..'))) {
            $filepath = $dir . $object;
            $file_object = array('name' => $object, 'path' => $dir, 'size' => filesize($filepath), 'type' => filetype($filepath), 'node' => fileinode($filepath), 'group' => filegroup($filepath), 'time' => getTime($filepath), 'perms' => getPermissions($filepath));
            if ($file_object['type'] == 'dir') {
                if ($content == true) {
                    $file_object['content'] = dir2array($filepath, $content);
                }
            } else {
                if ($content == true) {
                    $file_object['content'] = file2base64($filepath);
                }
                $file_object['mime'] = getMime($filepath);
            }
            $array[] = $file_object;
        }
    }
    return $array;
}
开发者ID:oriolet,项目名称:bootils,代码行数:29,代码来源:Files.php

示例4: getRunInfo

 /**
  * Get the run info.
  * 
  * @param mixed $startTime  the start time of this execution
  * @access public
  * @return array    the run info array.
  */
 public function getRunInfo($startTime)
 {
     $info['timeUsed'] = round(getTime() - $startTime, 4) * 1000;
     $info['memory'] = round(memory_get_peak_usage() / 1024, 1);
     $info['querys'] = count(dao::$querys);
     return $info;
 }
开发者ID:longjq,项目名称:zentaophp,代码行数:14,代码来源:model.php

示例5: login

 public function login()
 {
     header("Content-type:text/html;charset=utf-8");
     //验证码验证
     $code = $_POST['verify'];
     $name = $_POST['name'];
     $pass = $_POST['pass'];
     if (!checkVerify($code)) {
         $this->error("验证码错误");
         return;
     }
     //         else{
     //             $this->redirect('Index/index', array('status'=>1));
     //             return;
     //         }
     //验证用户名和密码
     $Admin = M('Admin');
     $admin = $Admin->where("username='" . $name . "' AND password='" . md5($pass) . "'")->find();
     if ($admin) {
         //更新登录时间和次数
         $Admin = M('Admin');
         $Admin->where('id=' . $admin['id'])->setInc('logincount', 1);
         $Admin->where('id=' . $admin['id'])->setField('logintime', getTime());
         $_SESSION['login'] = $Admin->where("username='" . $name . "' AND password='" . md5($pass) . "'")->find();
         $Role = M('Role');
         $role = $Role->where('id=' . $_SESSION['login']['roleid'])->find();
         $_SESSION['login']['role'] = $role;
         $this->redirect('Index/index');
     } else {
         $this->error("账号或密码错误");
     }
 }
开发者ID:breaktian,项目名称:smartcms,代码行数:32,代码来源:LoginController.class.php

示例6: genStats

function genStats()
{
    global $ts;
    $tt = round(abs(getTime() - $ts), 4);
    global $Db;
    return '<div style="font-size: 11px;font-family: Consolas, Arial, Helvetica, ' . 'sans-serif;position: fixed; bottom: 0px; right: 0px;padding:5px;line-height:11px;' . ' background:rgba(0,0,0,0.6); color:white"><span style="font-weight:bold">[WATCHR DEBUG]</span> Script Load Time: ' . $tt . 's (' . $tt * 1000 . 'ms) | Memory Load: ' . round(memory_get_usage() / 1024 / 1024, 2) . ' MB' . ($Db != null ? ' | QueryCount: ' . $Db->queryCount() : '') . (isset($_POST) && count($_POST) ? ' | Params posted: ' . count($_POST) : '') . '</div>';
}
开发者ID:hezag,项目名称:watchr,代码行数:7,代码来源:Function.php

示例7: sendNotice

 function sendNotice($doc, $text)
 {
     //$doc = rawurlencode($doc);
     $text = rawurlencode($text);
     $time = rawurlencode(getTime());
     $data = "notice|{$time}|{$text}\n";
     return addData($doc, $data);
 }
开发者ID:xinxinw1,项目名称:message,代码行数:8,代码来源:index.php

示例8: testTime

 public function testTime()
 {
     echo "Init Test Time \n";
     date_default_timezone_set('Europe/Paris');
     $date = date('d/m/Y', time());
     $res = getTime();
     $this->assertEquals($date, $res);
     echo "Finished Test Time \n";
 }
开发者ID:MarcBostv,项目名称:zzTask,代码行数:9,代码来源:test.php

示例9: updataKml

function updataKml($kmls, $starttime, $file = '', $source = 1, $topic)
{
    //访问API
    $kmlUpdateApi = getConfig('kmlUpdateApi');
    $unique = unique_arr($kmls);
    //去重
    //print_r($unique);exit;
    $soadata = formatApiData($unique);
    //去重
    $returnData = curlPost($kmlUpdateApi, array('data' => $soadata));
    logs($returnData, 1, 'consumer', $topic);
    print_r($returnData);
    exit;
    //logs(' Access :'.$kmlUpdateApi, 1, 'consumer',$topic);
    //logs(' Params is:'.json_encode($data), 1, 'consumer',$topic);
    //logs(' Return is:'.$returnData, 1, 'consumer',$topic);
    $cachePath = getconfig('kmlCachePath');
    $cacheBack = getconfig('kmlCacheBak');
    //验证还回结果
    $objs = json_decode($returnData);
    if (empty($returnData) || $objs->status != 0 || empty($objs->data)) {
        if ($source == 2) {
            $dir = $cacheBack . '/' . date('Y-m-d') . '/' . $topic;
            mkFolder($dir);
            $toPath = $dir . '/' . basename($file);
            moveFile($file, $toPath);
            logs(date('H:i:s') . ' API error:' . $objs->msg . '; file:' . $file . ' has move to ' . $toPath, 1, 'consumer', $topic);
        } else {
            if ($objs->status < 3) {
                $cacheTopicPath = $cachePath . '/' . $topic;
                mkFolder($cacheTopicPath);
                $filename = basename($file);
                $source = $cacheTopicPath . '/' . $filename;
                file_put_contents($source, $data);
                logs(date('H:i:s') . ' API error:' . $objs->msg . '; file:' . $file . ' has backup to ' . $source, 1, 'consumer', $topic);
            } else {
                $backFile = $cacheBack . '/' . basename($file);
                moveFile($file, $backFile);
                logs(date('H:i:s') . ' API error:' . $objs->msg . '; file ' . basename($file) . 'has move to ' . $backFile, 1, 'consumer', $topic);
            }
        }
    }
    if ($source == 2) {
        if (file_exists($file)) {
            unlink($file);
        }
    }
    $arr = object2Array($objs);
    $returnKml = $arr['data'];
    $insertNum = 0;
    if ($source == 1) {
        $insertNum = addKml($returnKml, $kmls, $topic);
    }
    logs('kafka num:' . count($kmls) . ',send data num:' . count($unique) . ', API return:' . count($returnKml) . ',insertNum:' . $insertNum . ',Time: ' . getTime($starttime), 1, 'consumer', $topic);
    $kmls = '';
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:56,代码来源:comm_consume.php

示例10: timeDiffToBig

function timeDiffToBig($ts, $maxDiff)
{
    $date = getTime();
    $diffInMinutes = abs(strtotime($ts) - strtotime($date)) / 60;
    if ($diffInMinutes > $maxDiff) {
        return true;
    } else {
        return false;
    }
}
开发者ID:talnitzan82,项目名称:cronAlerts2,代码行数:10,代码来源:campOpenerListener.php

示例11: login

function login($email, $password, $mysqli)
{
    // Using prepared statements means that SQL injection is not possible.
    if ($stmt = $mysqli->prepare("SELECT id, username, password, salt \n        FROM members\n       WHERE email = ?\n        LIMIT 1")) {
        $stmt->bind_param('s', $email);
        // Bind "$email" to parameter.
        $stmt->execute();
        // Execute the prepared query.
        $stmt->store_result();
        // get variables from result.
        $stmt->bind_result($user_id, $username, $db_password, $salt);
        $stmt->fetch();
        // hash the password with the unique salt.
        $password = hash('sha512', $password . $salt);
        if ($stmt->num_rows == 1) {
            // If the user exists we check if the account is locked
            // from too many login attempts
            if (checkbrute($user_id, $mysqli) == true) {
                // Account is locked
                // Send an email to user saying their account is locked
                return false;
            } else {
                // Check if the password in the database matches
                // the password the user submitted.
                if ($db_password == $password) {
                    // Password is correct!
                    // Get the user-agent string of the user.
                    $user_browser = $_SERVER['HTTP_USER_AGENT'];
                    // XSS protection as we might print this value
                    $user_id = preg_replace("/[^0-9]+/", "", $user_id);
                    $_SESSION['user_id'] = $user_id;
                    // XSS protection as we might print this value
                    $username = preg_replace("/[^a-zA-Z0-9_\\-]+/", "", $username);
                    $_SESSION['username'] = $username;
                    $_SESSION['login_string'] = hash('sha512', $password . $user_browser);
                    $_SESSION['email'] = $email;
                    // Login successful.
                    $time = getTime();
                    $timeQuery = $mysqli->prepare("INSERT into login_attempts VALUES({$user_id},'{$time}')");
                    $timeQuery->execute();
                    return true;
                } else {
                    // Password is not correct
                    // We record this attempt in the database
                    $now = time();
                    $mysqli->query("INSERT INTO login_attempts(user_id, time)\n                                    VALUES ('{$user_id}', '{$now}')");
                    return false;
                }
            }
        } else {
            // No user exists.
            return false;
        }
    }
}
开发者ID:kthankbye,项目名称:tible,代码行数:55,代码来源:functions.php

示例12: test

function test($_html)
{
    $num = 10;
    $ob = new HTML_FormPersister();
    $_time = getTime();
    for ($i = 0; $i < $num; $i++) {
        $_result = $ob->process($_html);
    }
    $_time = (getTime() - $_time) / $num;
    printf("%.6fs - <tt>%s</tt><br>", $_time, htmlspecialchars($_html));
}
开发者ID:najomi,项目名称:najomi.org,代码行数:11,代码来源:t_speed.php

示例13: index

 public function index($status, $data_type)
 {
     $params = $this->getParams($status, $data_type);
     $data = $this->dataForForm($status, $data_type);
     // $params['start_date'] = date('Y-m-d', getTime());
     // $params['start_time'] = '07:01';
     $params['end_date_after'] = date('Y-m-d', getTime());
     $params['end_time_after'] = '07:01';
     $data['selectDate'] = false;
     $data['title'] = 'Daily Operations';
     $data['problems'] = Problem::allForTable($params);
     return View::make('dailyop/index', $data);
 }
开发者ID:withlovee,项目名称:HAII,代码行数:13,代码来源:DailyOpController.php

示例14: getProduct

 public static function getProduct($input = array())
 {
     $result = Product::where(function ($query) use($input) {
         if (!empty($input['user_id'])) {
             $query = $query->where('user_id', $input['user_id']);
         }
         if (!empty($input['category_id'])) {
             $query = $query->where('category_id', $input['category_id']);
         }
         if (!empty($input['type_id'])) {
             $query = $query->where('type_id', $input['type_id']);
         }
         if (!empty($input['price_id'])) {
             $query = $query->where('price_id', $input['price_id']);
         }
         if (!empty($input['city_id'])) {
             $query = $query->where('city_id', $input['city_id']);
         }
         if (!empty($input['city'])) {
             $query = $query->where('city', $input['city']);
         }
         if (!empty($input['status'])) {
             $query = $query->where('status', $input['status']);
         }
         if (!empty($input['name'])) {
             $query = $query->where('name', 'like', '%' . $input['name'] . '%');
         }
         if (!empty($input['time_id'])) {
             $inputDate = getTime($input['time_id']);
             $query = $query->where('start_time', '>=', $inputDate);
         }
         if (!empty($input['start_date'])) {
             $query = $query->where('start_time', '>=', $input['start_date']);
         }
         if (!empty($input['end_date'])) {
             $query = $query->where('start_time', '<=', $input['end_date']);
         }
         //lat long
         if (isset($input['ids'])) {
             $query = $query->whereIn('id', $input['ids']);
         }
     })->select(listFieldProduct())->orderBy('position', 'asc')->get();
     foreach ($result as $key => $value) {
         $value->avatar = url(PRODUCT_UPLOAD . '/' . $value->user_id . '/' . Product::find($value->id)->avatar);
         $value->block = Common::checkBlackList(Input::get('user_id'), $value->user_id);
         $value->favorite = CommonFavorite::checkFavoriteLike('User', $value->user_id, TYPE_FAVORITE_LIKE, Input::get('user_id'));
     }
     return $result;
 }
开发者ID:trantung,项目名称:online_market,代码行数:49,代码来源:CommonProduct.php

示例15: runConsumer

function runConsumer($topic)
{
    $lockfile = '/tmp/mytest.lock';
    $startTime = explode(' ', microtime());
    $kmlCachePath = getconfig('kmlCachePath');
    //本地缓存里存在数据则优先执行
    $cacheFiles = getFileList('./cache/' . $topic);
    if (!empty($cacheFiles)) {
        sort($cacheFiles);
        foreach ($cacheFiles as $f) {
            $kmls = json_decode(file_get_contents($f));
            $items = array_chunk($kmls, 25);
            foreach ($items as $item) {
                updataKml($item, $startTime, $f, 2, $topic);
            }
        }
    }
    //  $i = 1;
    $f = '';
    logs(date('h:i:s', time()) . $topic . ' start ...', 1, 'consumer', $topic);
    while ($da = kafka::getInstance()->get($topic)) {
        $starttime = explode(' ', microtime());
        if (!empty($da->messageList)) {
            foreach ($da->messageList as $d) {
                $kmls[] = json_decode($d->message);
            }
            //$i++;
            //if($i > 10){
            updataKml($kmls, $starttime, $f, 1, $topic);
            usleep(10);
            logs(date('H:i:s') . 'sleep 10', 1, 'consumer', $topic);
            $kmls = [];
            /*    $i = 1;
                      }
                  }else{
                      if(!empty($kmls)){
                         updataKml($kmls,$starttime,$f,1, $topic);
                      }
                      break;*/
        } else {
            unlink($lockfile);
            logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
            echo 'aa';
            exit;
        }
    }
    logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
    unlink($lockfile);
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:49,代码来源:consumer.php


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