本文整理汇总了PHP中getTime函数的典型用法代码示例。如果您正苦于以下问题:PHP getTime函数的具体用法?PHP getTime怎么用?PHP getTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: thai_date
function thai_date($date = null)
{
if (!$date) {
$date = getTime();
}
$TH_Day = array("อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัสบดี", "ศุกร์", "เสาร์");
$TH_Month = array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฏาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
$nDay = date("w", $date);
$nMonth = date("n", $date) - 1;
$date = date("j", $date);
$y = date("Y", $date) + 543;
$y = '';
// return getTime();
return "{$date} {$TH_Month[$nMonth]} {$y}";
}
开发者ID:withlovee,项目名称:HAII,代码行数:15,代码来源:helpers.php
示例17: runProducer
function runProducer()
{
$kmlPath = getconfig('kmlPath');
$xml_file = getFileList($kmlPath);
$lockfile = '/tmp/producer.lock';
if (empty($xml_file)) {
logs(date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty.");
unlink($lockfile);
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());
$fileName = basename($f);
insertKafka($kmldata, $fileName);
logs($i . '>>>' . basename($f) . ',file count:' . $fNum . ',total:' . $totalNum . ',into kafka time:' . getTime($kafkaTime));
if ($n > 100) {
usleep(200);
$n = 1;
}
//备份文件:
backFile($f);
}
logs('Total time:' . getTime($startTime));
//unlock();
//$lockfile = '/tmp/producer.lock';
unlink($lockfile);
exit;
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:45,代码来源:producer.php
示例18: benchmarkSelectsAction
/**
* Runs a simple selects benchmark of given number of cycles
*
* @return void
*/
public function benchmarkSelectsAction()
{
$stats['memoryStart'] = memory_get_usage() / 1024 . ' KB';
isset($_GET['cycles']) ? $cycles = $_GET['cycles'] : ($cycles = 1000);
$stats['cycles'] = $cycles;
$startTime = getTime();
for ($i = 0; $i < $cycles; $i++) {
$this->getStore();
}
$endTime = getTime();
$stats['memoryEnd'] = memory_get_usage() / 1024 . ' KB';
$stats['memoryPeak'] = memory_get_peak_usage() / 1024 . ' KB';
foreach ($stats as $value) {
echo $value . ',';
}
echo number_format($endTime - $startTime, 6) . ',';
$this->_helper->viewRenderer->setRender('index');
}
开发者ID:rehoutm,项目名称:Zend_Db-vs.-Doctrine-2,代码行数:23,代码来源:IndexController.php
示例19: display_tweet
function display_tweet($tweet)
{
echo "<div class='tweetContainer'>";
echo "<table>";
echo "<tr>";
echo "<td class='tweetImage'>";
echo "<img src='./default.jpg' class='tweetPicture' alt='display picture'/>";
echo "</td>";
echo "<td class='tweetContent'>";
echo "<a class='tweetUser' href='./" . $tweet['username'] . "'><strong class='username'>" . $tweet['name'] . "</strong> <span class='useralias'> @" . $tweet['username'] . "</span></a><span class='tweetTime'> - " . getTime($tweet['timestamp']) . "</span>";
$new_tweet = preg_replace('/@(\\w+)/', '<a href=./$1>$0</a>', $tweet['tweet']);
$new_tweet = preg_replace('/#(\\w+)/', '<a href=./hashtag/$1>$0</a>', $new_tweet);
echo "<div class='tweetText'>" . make_clickable($new_tweet) . "</div>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
}
开发者ID:CyrilP,项目名称:Twitter-Like-System-PHP,代码行数:18,代码来源:functions.php
示例20: mysqli_close
mysqli_close($db);
$nbresa = mysqli_num_rows($resarow);
// Ligne entête
while ($username = mysqli_fetch_array($userrow)) {
$csv_output = "Historique des réservations de " . $username['nom_user'] . " " . $username['prenom_user'];
$csv_output .= "\n";
$csv_output .= "Coordonnées" . $separator . $username['adresse_user'] . $separator . $username['code_postale_city'] . $separator . $username['nom_city'] . $separator . $username['pays_city'];
$csv_output .= "\n";
$csv_output .= "Date de Naissance" . $separator . $username['jour_naissance_user'] . "/ " . $username['mois_naissance_user'] . "/ " . $username['annee_naissance_user'];
$csv_output .= "\n";
$csv_output .= "Téléphone/mail" . $separator . $username['tel_user'] . $separator . $username['mail_user'];
$csv_output .= "\n";
$csv_output .= "Date d'inscription" . $separator . $username['date_insc_user'] . $separator . "login" . $separator . $username['login_user'];
$csv_output .= "\n";
$csv_output .= "\n";
}
$csv_output .= "Liste des réservations entre le " . getDateFr($date1) . " et le " . getDateFr($date2);
$csv_output .= "\n";
$csv_output .= "\n";
$csv_output .= "date" . $separator . "Heure de début" . $separator . "Heure de fin" . $separator . "Durée" . $separator . "Poste";
$csv_output .= "\n";
if ($nbresa > 0) {
while ($row = mysqli_fetch_array($resarow)) {
$csv_output .= dateFr($row['dateresa_resa']) . $separator . getTime($row['debut_resa']) . $separator . getTime($row['debut_resa'] + $row['duree_resa']) . $separator . getTime($row['duree_resa']) . $separator . $row['nom_computer'];
$csv_output .= "\n";
}
} else {
$csv_output = "Pas de données pour la période demandée pour l'adhérent";
}
print $csv_output;
exit;
开发者ID:ctariel,项目名称:CyberGestionnaireLGB,代码行数:31,代码来源:csv_resa-user.php
注:本文中的getTime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论