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


PHP duration函数代码示例

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


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

示例1: getStatusDataRows

 public function getStatusDataRows()
 {
     $rows = array();
     $rows[] = "<tr><th>OpCache Version</th><td>{$this->_configuration['version']['version']}</td></tr>\n";
     $rows[] = "<tr><th>PHP Version</th><td>" . phpversion() . "</td></tr>\n";
     if (!empty($_SERVER['SERVER_NAME'])) {
         $rows[] = "<tr><th>Host</th><td>{$_SERVER['SERVER_NAME']}</td></tr>\n";
     }
     if (!empty($_SERVER['SERVER_SOFTWARE'])) {
         $rows[] = "<tr><th>Server Software</th><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n";
     }
     $rows[] = "<tr><th>Uptime</th><td>" . duration($this->_status['opcache_statistics']['start_time']) . "</td></tr>\n";
     $rows[] = '<tr><th>Clear cache</th><td><a href="?clear_cache=1">&#10006; Clear Cache</a></td></tr>' . "\n";
     foreach ($this->_status as $key => $value) {
         if ($key === 'scripts') {
             continue;
         }
         if (is_array($value)) {
             foreach ($value as $k => $v) {
                 if ($v === false) {
                     $value = 'false';
                 }
                 if ($v === true) {
                     $value = 'true';
                 }
                 if ($k === 'used_memory' || $k === 'free_memory' || $k === 'wasted_memory') {
                     $v = $this->_size_for_humans($v);
                 }
                 if ($k === 'current_wasted_percentage' || $k === 'opcache_hit_rate') {
                     $v = number_format($v, 2) . '%';
                 }
                 if ($k === 'blacklist_miss_ratio') {
                     $v = number_format($v, 2) . '%';
                 }
                 if ($k === 'start_time' || $k === 'last_restart_time') {
                     $v = $v ? date(DATE_RFC822, $v) : 'never';
                 }
                 if (THOUSAND_SEPARATOR === true && is_int($v)) {
                     $v = number_format($v);
                 }
                 $rows[] = "<tr><th>{$k}</th><td>{$v}</td></tr>\n";
             }
             continue;
         }
         if ($value === false) {
             $value = 'false';
         }
         if ($value === true) {
             $value = 'true';
         }
         $rows[] = "<tr><th>{$key}</th><td>{$value}</td></tr>\n";
     }
     return implode("\n", $rows);
 }
开发者ID:RamosSatue,项目名称:vagrant_moodle,代码行数:54,代码来源:opcache.php

示例2: send_footers

function send_footers()
{
    global $settings, $c, $session, $theme, $dbconn, $total_query_time, $debuglevel;
    global $REQUEST_URI, $HTTP_USER_AGENT, $HTTP_REFERER, $PHP_SELF;
    $theme->EndContentArea();
    if ($theme->panel_right) {
        $theme->RightPanel();
    }
    $theme->EndPanels();
    if ($theme->panel_bottom) {
        $theme->PageFooter();
    }
    echo <<<CLOSEHTML
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<script language="JavaScript" src="js/overlib.js"></script>
</body>
</html>
CLOSEHTML;
    if (is_object($settings) && $settings->is_modified()) {
        if (!is_numeric($settings->get('counter'))) {
            $settings->set('counter', 0);
        } else {
            $settings->set('counter', $settings->get('counter') + 1);
        }
        $config_data_string = qpg($settings->to_save());
        $query = "UPDATE session SET session_config={$config_data_string} ";
        $query .= "WHERE session_id={$session->session_id} ";
        $query .= "AND session_config != {$config_data_string}; ";
        if ($session->user_no > 0) {
            $query .= "UPDATE usr SET config_data={$config_data_string} WHERE user_no={$session->user_no} ";
            $query .= "AND config_data != {$config_data_string}; ";
        }
        $result = awm_pgexec($dbconn, $query);
    }
    error_reporting(7);
    if ($debuglevel > 0) {
        $total_query_time = sprintf("%3.06lf", $total_query_time);
        error_log($c->sysabbr . " total_query_ TQ: {$total_query_time} URI: {$REQUEST_URI}", 0);
        $total_time = sprintf("%3.06lf", duration($c->started, microtime()));
        error_log($c->sysabbr . " process_time TT: {$total_time}      Agent: {$HTTP_USER_AGENT} Referrer: {$HTTP_REFERER}  ", 0);
        error_log("=============================================== Endof {$PHP_SELF}");
    }
}
开发者ID:Br3nda,项目名称:wrms,代码行数:43,代码来源:page-footer.php

示例3: is_session_valid

function is_session_valid()
{
    if (empty($_SESSION['timestamp']) or empty($_SESSION['token-issue'])) {
        return FALSE;
    }
    $session = duration($_SESSION['timestamp']);
    $token = duration($_SESSION['token-issue']);
    if ($session > SESSION_DURATION) {
        return false;
    } else {
        if ($token > TOKEN_DURATION) {
            return false;
        } else {
            if (empty($_SESSION["token"])) {
                return false;
            } else {
                return true;
            }
        }
    }
}
开发者ID:rungwe,项目名称:onemall,代码行数:21,代码来源:session.php

示例4: check_login

<?php

check_login();
if (!defined('BASEPATH')) {
    exit('Nu poti accesa acest fisier direct.');
}
set_title(site_name() . ' - Caracterele mele');
$data = $DB->query("SELECT * FROM " . PLAYER_DATABASE . ".player WHERE account_id = '" . $_SESSION['user_data']['id'] . "'");
$users = array();
$i = 0;
while ($row = $DB->fetch($data)) {
    $users[$i]['id'] = $row['id'];
    $users[$i]['name'] = $row['name'];
    $users[$i]['level'] = $row['level'];
    $users[$i]['time'] = $row['playtime'] > 0 ? duration($row['playtime'] * 60) : 'nedeterminat';
    $users[$i]['class'] = char_class($row['job']);
    $i++;
}
$smarty->assign('users', $users);
assign('content_tpl', 'content/character');
开发者ID:ionutmilica,项目名称:my-archive,代码行数:20,代码来源:character.php

示例5: name

}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<link href='http://fonts.googleapis.com/css?family=Josefin+Sans' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" type="text/css" href="dine.css?v=0.1">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
        <script src='https://www.google.com/recaptcha/api.js'></script>
    </head>
	<body id="plate">
        <div id="text">
            <?php 
$who = name();
$where = place();
$when = when();
$duration = duration();
$email = email();
$why = reason();
$mail_text = "Who:   {$who}\r\n" . "Where: {$where}\r\n" . "When:  {$when}\r\n" . "Duration: {$duration} hour(s) \r\n" . "Email: {$email}\r\n" . "Reason: {$why}\r\n";
if (verify_captcha()) {
    send_mail($mail_text, $email, $who);
    echo "Mail sent, now you must wait for me to respond.";
} else {
    echo "Captcha failed, I don't dine with robots";
}
?>
        </div>
    </body>
</html>
开发者ID:TabLand,项目名称:dine_me,代码行数:30,代码来源:mail_out.php

示例6: date

$h3_ = '<font face="' . $h3['font_face'] . '" size=' . $h3['font_size'] . ' color="' . $h3['color'] . '">' . ($h3['bold'] ? '<b>' : '') . ($h3['italic'] ? '<i>' : '') . ($h3['underline'] ? '<u>' : '');
$_h3 = ($h3['underline'] ? '</u>' : '') . ($h3['italic'] ? '</i>' : '') . ($h3['bold'] ? '</b>' : '') . '</font>';
// Default text style
$d_ = '<font face="' . $default['font_face'] . '" size=' . $default['font_size'] . ' color="' . $default['color'] . '">' . ($default['bold'] ? '<b>' : '') . ($default['italic'] ? '<i>' : '') . ($default['underline'] ? '<u>' : '');
$_d = ($default['underline'] ? '</u>' : '') . ($default['italic'] ? '</i>' : '') . ($default['bold'] ? '</b>' : '') . '</font>';
// Stack trace text style
$st_ = '<font face="' . $strace['font_face'] . '" size=' . $strace['font_size'] . ' color="' . $strace['color'] . '">' . ($strace['bold'] ? '<b>' : '') . ($strace['italic'] ? '<i>' : '') . ($strace['underline'] ? '<u>' : '');
$_st = ($strace['underline'] ? '</u>' : '') . ($strace['italic'] ? '</i>' : '') . ($strace['bold'] ? '</b>' : '') . '</font>';
// Result content
$bigball['width'] = '32';
$bigball['height'] = '32';
$build_url = 'TODO: Find a way to list URL to Jenkins build';
$build_report = 'TODO: Find a way to list URL to HTML report';
$build_project = 'TODO: Find a way to list project';
$build_date = date('D M j H:i:s Y', $result->getTimeStart());
$build_duration = duration($result->getDuration());
$changes = 'TODO: Find a way to list changes';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <body>
  <table border=0 cellpadding=0 cellspacing=4 width="100%">
   <tr>
    <th align="right" width="100"><img src="<?php 
echo $bigball['src'];
?>
" width=<?php 
echo $bigball['width'];
?>
 height=<?php 
echo $bigball['height'];
开发者ID:ohaal,项目名称:selenium-zoetrope,代码行数:31,代码来源:mail_report.php

示例7: get_time_difference

function get_time_difference($post_time, $decorate = false)
{
    $timestamp = time() - strtotime($post_time);
    if ($decorate == true) {
        return duration($timestamp);
    } else {
        return $timestamp;
    }
}
开发者ID:alx,项目名称:blogsfera,代码行数:9,代码来源:portal_widgets.php

示例8: email

}
if (is_valid_email()) {
    $a_valid_email = "valid";
    $may_or_may_not = "may";
} else {
    $a_valid_email = "invalid";
    $may_or_may_not = "may not";
}
echo "So your name is {$who}.<br>" . "You want to meet at {$where} on {$when} hours for {$duration} {$hours} because {$why}.<br>" . "I think I {$am_free_or_busy}<br>" . "You can be contacted at {$email},<br>" . "which to me looks to be {$a_valid_email} therefore I {$may_or_may_not} try to respond.";
?>
                <input type="hidden" name="email" value="<?php 
echo email();
?>
"/>
                <input type="hidden" name="duration" value="<?php 
echo duration();
?>
"/>
                <input type="hidden" name="when" value="<?php 
echo when();
?>
"/>
                <input type="hidden" name="why" value="<?php 
echo reason();
?>
"/>
                <input type="hidden" name="who" value="<?php 
echo name();
?>
"/>
                <input type="hidden" name="where" value="<?php 
开发者ID:TabLand,项目名称:dine_me,代码行数:31,代码来源:confirm.php

示例9: count

$html .= '<div class="circle" style="border-color:#' . $color . '; background-color:#' . $color . ';"></div>';
$html .= '</div>';
$html .= '<div class="cell">';
$html .= '<span class="from">' . $from['name'] . '</span>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row middle">';
$html .= '<div class="cell">';
$html .= '<span class="icon" style="color:#' . $color . ';"></span>';
$html .= '</div>';
$html .= '<div class="cell road">';
$html .= '<div class="line" style="border-color:#' . $color . '; background-color:#' . $color . ';"></div>';
$html .= '</div>';
$html .= '<div class="cell">';
$html .= '<span class="direction">' . $displayInformations['direction'] . '</span>';
$html .= '<span class="stop_duration">' . count($stop_date_times) . ' arrêts : ' . duration($duration) . '</span>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="row end">';
$html .= '<div class="cell">';
$html .= '<span class="arrival_date_time">' . date_time($arrival_date_time) . '</span>';
$html .= '</div>';
$html .= '<div class="cell road">';
$html .= '<div class="circle" style="border-color:#' . $color . '; background-color:#' . $color . ';"></div>';
$html .= '</div>';
$html .= '<div class="cell">';
$html .= '<span class="to">' . $to['name'] . '</span>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
echo $html;
开发者ID:VSasyan,项目名称:navitia,代码行数:31,代码来源:public_transport.php

示例10: bsize

 $passtime = $time - $cache['start_time'] > 0 ? $time - $cache['start_time'] : 1;
 // zero division
 $mem_size = $mem['num_seg'] * $mem['seg_size'];
 $mem_avail = $mem['avail_mem'];
 $mem_used = $mem_size - $mem_avail;
 $seg_size = bsize($mem['seg_size']);
 $sharedmem = sprintf($lng['apcuinfo']['sharedmemval'], $mem['num_seg'], $seg_size, $cache['memory_type']);
 $req_rate_user = sprintf("%.2f", $cache['num_hits'] ? ($cache['num_hits'] + $cache['num_misses']) / $passtime : 0);
 $hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? $cache['num_hits'] / $passtime : 0);
 $miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? $cache['num_misses'] / $passtime : 0);
 $insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? $cache['num_inserts'] / $passtime : 0);
 $apcversion = phpversion('apcu');
 $phpversion = phpversion();
 $number_vars = $cache['num_entries'];
 $starttime = date('Y-m-d H:i:s', $cache['start_time']);
 $uptime_duration = duration($cache['start_time']);
 $size_vars = bsize($cache['mem_size']);
 // check for possible empty values that are used in the templates
 if (!isset($cache['file_upload_progress'])) {
     $cache['file_upload_progress'] = $lng['logger']['unknown'];
 }
 if (!isset($cache['num_expunges'])) {
     $cache['num_expunges'] = $lng['logger']['unknown'];
 }
 $runtimelines = '';
 foreach (ini_get_all('apcu') as $name => $v) {
     $value = $v['local_value'];
     eval("\$runtimelines.=\"" . getTemplate("settings/apcuinfo/runtime_line") . "\";");
 }
 $freemem = bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size);
 $usedmem = bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size);
开发者ID:asemen,项目名称:Froxlor,代码行数:31,代码来源:admin_apcuinfo.php

示例11: parse_plugin_cfg

  $unraid = parse_plugin_cfg("dynamix",true);
  $events = explode('|', $unraid['notify']['events']);
  $temps = array(190,194);
  $max = $unraid['display']['max'];
  $hot = $unraid['display']['hot'];
  exec("smartctl -A /dev/$port|awk 'NR>7'",$output);
  foreach ($output as $line) {
    if (!$line) continue;
    $info = explode(' ', trim(preg_replace('/\s+/',' ',$line)), 10);
    $color = "";
    if (array_search($info[0], $events)!==false && $info[9]>0) $color = " class='orange-text'";
    else if (array_search($info[0], $temps)!==false) {
      if ($info[9]>=$max) $color = " class='red-text'"; else if ($info[9]>=$hot) $color = " class='orange-text'";
    }
    echo "<tr{$color}>";
    if ($info[0] == 9 && is_numeric($info[9])) $info[9] .= duration($info[9]);
    foreach ($info as $field) echo "<td>".str_replace('_',' ',$field)."</td>";
    echo "</tr>";
  }
  break;
case "capabilities":
  exec("smartctl -c /dev/$port|awk 'NR>5'",$output);
  $row = ["","",""];
  foreach ($output as $line) {
    if (!$line) continue;
    $line = preg_replace('/^_/','__',preg_replace(array('/__+/','/_ +_/'),'_',str_replace(array(chr(9),')','('),'_',$line)));
    $info = array_map('trim', explode('_', preg_replace('/_( +)_ /','__',$line), 3));
    if (isset($info[0])) $row[0] .= ($row[0] ? " " : "").$info[0];
    if (isset($info[1])) $row[1] .= ($row[1] ? " " : "").$info[1];
    if (isset($info[2])) $row[2] .= ($row[2] ? " " : "").$info[2];
    if (substr($row[2],-1)=='.') {
开发者ID:roninkenji,项目名称:dynamix,代码行数:31,代码来源:SmartInfo.php

示例12: duration

     case "Meeting":
         $title = '<strong>' . $div["type"] . '</strong> ' . $div["start"] . '<br />' . $div["subject"];
         $caption = $div["type"] . ' ' . $div["start"] . ' to ' . $div["end"] . '<br />(' . duration($div["duration"], 'long') . ')';
         $overdiv = $div["subject"];
         if ($div["notes"]) {
             $overdiv .= "\n\n" . $div["notes"];
         }
         break;
     case "Note":
         $title = '<strong>' . $div["type"] . '</strong> ' . $div["start"] . '<br />' . $div["subject"];
         $caption = $div["type"] . ' ' . $div["start"] . ' to ' . $div["end"] . '<br />(' . duration($div["duration"], 'long') . ')';
         $overdiv = $div["subject"] . "\n\n" . $div["notes"];
         break;
     case "Lunch":
         $title = '<strong>' . $div["type"] . '</strong> ' . $div["start"] . '<br />' . $div["user"];
         $caption = $div["type"] . ' ' . $div["start"] . ' to ' . $div["end"] . '<br />(' . duration($div["duration"], 'long') . ')';
         $overdiv = "User:\n" . $div["user"];
         break;
 }
 if ($div["attendees"]) {
     $overdiv .= "\n\nAttendees:\n" . $div["attendees"];
 }
 $overdiv = str_replace("\n", "<br />", $overdiv);
 $overdiv = str_replace("'", "\\'", $overdiv);
 $div_mouseover = 'return overlib(\'' . $overdiv . '\',CAPTION,\'' . $caption . '\');';
 //calEventOver(this,'.($div["app_height"]-6).');
 $div_mouseout = 'nd();';
 //calEventOut(this,'.($div["app_height"]-6).');
 // write the div
 if ($div["app_height"] < 24) {
     $app_height = 24;
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:31,代码来源:calendar_print.php

示例13: duration

if (time() > ($endtime - (2 * $week))) {
	$allow_bonuses = true;
}

if (time() < ($endtime - (5 * $day))) {

	$allow_vacation = true;
}

$diff       = $endtime - $time;
if ($time > $endtime) { 
	$game_offline = true;
}

$d = duration($diff);

$resetA = "Reset in: $d";

$conf_announcement = $announce  . ' ' .  $resetA;
 
// If changing these, update User
$conf['start-gold'           ] = 50000;
$conf['start-attackturns'    ] = 50;
$conf['start-uu'             ] = 0;
$conf['start-sasoldiers'     ] = 75;
$conf['start-dasoldiers'     ] = 75;

$conf['officers-per-page'    ] = 5;
$conf['max-officers'         ] = 15;
$conf['users-per-page'       ] = 30;
开发者ID:Naddiseo,项目名称:WW2Game,代码行数:30,代码来源:conf.php

示例14: foreach

            <th class="vtip" title="Seconds since the last access for the most recent item evicted from this class.<br>Use this to judge how recently active your evicted data is">Evicted time</th>
            <th class="vtip" title="Age of the oldest item in the LRU.">Age</th>
            <th class="vtip" title="Details and keys">Link</th>
            </tr>
            </thead>
            <tbody>

EOB;
            foreach ($entries as $slabId => $slab) {
                $itemsCount = $slab['number'];
                $chunkSize = $slabInfo[$server][$slabId]['chunk_size'];
                $itemsSpace = round($itemsCount * $chunkSize * 100 / $memcacheStats['limit_maxbytes'], 3);
                $chunks_total = $slabInfo[$server][$slabId]['total_chunks'];
                $chunks_used = $slabInfo[$server][$slabId]['used_chunks'];
                $percentFree = round(($chunks_total - $chunks_used) * 100 / $chunks_total, 2);
                $totalBytes = $chunks_total * $chunkSize;
                $usedBytes = $slabInfo[$server][$slabId]['used_chunks'] * $chunkSize;
                $unusedBytes = $totalBytes - $usedBytes;
                $dumpUrl = $PHP_SELF . '&op=2&server=' . array_search($server, $MEMCACHE_SERVERS) . '&dumpslab=' . $slabId;
                echo "\n\t\t\t\t\t<tr class=tr-{$m}>\n\t\t\t\t\t<td class=td-0>" . $slabId . "</td>\n\t\t\t\t\t<td>" . $itemsCount . "</td>\n\t\t\t\t\t<td>" . $chunkSize . "</td>\n\t\t\t\t\t<td>" . $slabInfo[$server][$slabId]['chunks_per_page'] . "</td>\n\t\t\t\t\t<td>" . $slabInfo[$server][$slabId]['total_pages'] . "</td>\n\t\t\t\t\t<td class='vtip' title='" . bsize($totalBytes) . "'>" . $chunks_total . "</td>\n\t\t\t\t\t<td class='vtip' title='" . bsize($usedBytes) . "'>" . $chunks_used . "</td>\n\t\t\t\t\t<td class='vtip' title='" . $percentFree . " % allocated chunks in this class'>" . ($chunks_total - $chunks_used) . "</td>\n\t\t\t\t\t<td class='vtip' title='" . bsize($unusedBytes) . "'>" . $unusedBytes . "</td>\n\t\t\t\t\t<td>" . $itemsSpace . "</td>\n\t\t\t\t\t<td>" . (int) $slab['evicted'] . "</td>\n\t\t\t\t\t<td>" . (int) $slab['evicted_time'] . "</td>\n                    <td>" . duration($time - $slab['age']) . "</td>\n\t\t\t\t\t<td class=td-0><center><a href=\"" . $dumpUrl . "\">details</a></center></td>\n\n                    </tr>";
                $m = 1 - $m;
            }
            echo <<<EOB
\t\t\t</tbody></table>
\t\t\t<hr/>
EOB;
        }
        break;
        break;
}
echo getFooter();
开发者ID:Shopatron,项目名称:mcrouter-util,代码行数:31,代码来源:memcache.php

示例15: file

include "config.php";
include "commonfunctions.php";
$irpg_page_title = "Player Info";
include "header.php";
?>

  <h1>Players</h1>
  <h2>Pick a player to view</h2>
  <p class="small">[gray=offline]</p>
  <ol>
<?php 
$file = file($irpg_db);
unset($file[0]);
usort($file, 'cmp_level_desc');
foreach ($file as $line) {
    list($user, , , $level, $class, $secs, , , $online) = explode("\t", trim($line));
    $class = htmlentities($class);
    $next_level = duration($secs);
    print "    <li" . (!$online ? " class=\"offline\"" : "") . "><a" . (!$online ? " class=\"offline\"" : "") . " href=\"playerview.php?player=" . urlencode($user) . "\">" . htmlentities($user) . "</a>, the level {$level} {$class}. Next level in {$next_level}.</li>\n";
}
?>
  </ol>
  <p>For a script to view player stats from a terminal, try <a
  href="idlerpg-adv.txt">this</a> perl script by
  <a href="mailto:daxxar@mental.mine.nu">daxxar</a>.</p>

  <p>See player stats in <a href="db.php">table format</a>.</p>

<?php 
include "footer.php";
开发者ID:swcombine,项目名称:idlerpg,代码行数:30,代码来源:players.php


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