本文整理汇总了PHP中timer函数的典型用法代码示例。如果您正苦于以下问题:PHP timer函数的具体用法?PHP timer怎么用?PHP timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
public function exec()
{
// Download binary file
if ($this->_binary_file) {
// Send headers
$this->_sendHeaders();
// Send file
readfile($this->_binary_file);
exit;
}
// 404? (without template)
if (!$this->_template || !Template::exists($this->_template) && $this->_template != '_404') {
$this->setData('cache.excluded', true);
$this->_template = '_404';
}
// Output
timer('start', 'template_parse');
ob_start();
Template::parse($this->_template, $this->_data);
$content = ob_get_clean();
$content = Event::filter('content', $content);
timer('end', 'template_parse');
// If not excluding cache, then save cache
if (!$this->getData('cache.excluded')) {
Cache::factory()->save($this->_headers, $content, $this->getData('page_ttl'));
}
// Send headers
$this->_sendHeaders();
// Send content
echo Event::filter('cache', $content);
}
示例2: display
function display($data)
{
global $base, $ev;
echo $data, "\n";
if ($ev) {
$ev->delTimer();
}
$ev = null;
timer();
}
示例3: cek_login
function cek_login()
{
$timeout = $_SESSION[timeout];
if (time() < $timeout) {
timer();
return true;
} else {
unset($_SESSION[timeout]);
return false;
}
}
示例4: returntimer
function returntimer($pagetimer)
{
/*$intertime = timer() - $timer;
//if ($_SERVER['REQUEST_TIME']) $intertime = timer() - $_SERVER['REQUEST_TIME'];
$lol = substr($intertime, 2, 3);
if ($lol[0] == 0 && $lol[1] == 0) $lol = $lol[2];
elseif ($lol[0] == 0) $lol = $lol[1].$lol[2];
$intertime = ($intertime >= 1 ? substr($intertime, 0, 5)." sec" : $lol."ms");
return $intertime;*/
$timer = round(timer() - $pagetimer, 3);
return $timer[0] == 0 ? round(substr($timer, 2)) . " ms" : $timer . " sec";
}
示例5: create
public function create()
{
//$core = Singleton::factory('Core');
$title = KvLite::get('site', 'title');
$this->headTitle($title)->setSeparator(' :: ');
$this->genMeta();
//$this->headLink()->prependStylesheet('/asset/css/layout.css');
//$this->headLink()->prependStylesheet('/asset/css/main.css');
//$this->headLink()->prependStylesheet('/asset/css/base.css');
if (defined('TIMERSTART') && !defined('TIMERTOTAL')) {
timer();
}
return $this->render('layout.phtml');
}
示例6: print_lateral
function print_lateral($nick, $cargo_ID = false, $time, $siglas = '', $user_ID = '', $avatar = '', $votos = 0, $voto = false, $tipo = 'msg', $item_ID = 0)
{
global $pol;
if ($cargo_ID == 99) {
$cargo = 'Extranjero';
}
return '<table border="0" width="100%"><tr>
<td width="40" valign="top">' . ($avatar == 'true' ? '<span>' . avatar($user_ID, 40) . '</span>' : '') . '</td>
<td align="right" valign="top" nowrap="nowrap">
<b>' . ($cargo_ID ? '<img src="' . IMG . 'cargos/' . $cargo_ID . '.gif" /> ' : '') . crear_link($nick) . '</b><br />
<span class="min">' . timer($time) . ' ' . $siglas . '</span>
<span id="' . $tipo . $item_ID . '">' . confianza($votos) . '</span>' . ($pol['pais'] == PAIS && $item_ID != 0 && $user_ID != $pol['user_ID'] ? '<br />
<span id="data_' . $tipo . $item_ID . '" class="votar" type="' . $tipo . '" name="' . $item_ID . '" value="' . $voto . '"></span>' : '') . '
</td></tr></table>';
}
示例7: returntimer
function returntimer($pagetimer)
{
// better then previous but still bit shitty assumes all pages are +10ms :)
$timer = timer() - $pagetimer;
if ($timer[0] == 0) {
if (substr($timer, 2, 1) == 0) {
$timer = substr($timer, 3, 2) . " ms";
} else {
$timer = substr($timer, 2, 3) . " ms";
}
// +100 ms
} else {
$timer = $timer . " sec";
}
return $timer;
}
示例8: run
public function run()
{
// $lock = SynLockFactory::getFileSynLock(0x1234);
// tprintError("try to get the lock....");
// $lock->tryLock();
// tprintOk("get the lock.");
// sleep(10);
// tprintWarning("release the lock.");
// $lock->unlock();
$model = Loader::model("news");
$timer = timer();
for ($i = 0; $i < 1000000; $i++) {
$data = array('name' => 'xiaoming', 'pass' => 'xiaoming_pass', 'address' => 'china ShenZhen');
$model->insert($data);
}
tprintOk("插入完成,耗时:" . (timer() - $timer) . " 秒");
}
示例9: prepareUser
public function prepareUser()
{
$i = microtime(true);
error_log(' [TIMER] ------------');
$this->loadCandidates();
timer($i, 'loadCandidates');
$this->loadDiscussion();
timer($i, 'loadDiscussion');
$this->loadResponses2();
timer($i, 'loadResponses');
$this->prepareActivity();
timer($i, 'prepareActivity');
$this->prepareSort();
timer($i, 'prepareSort');
$this->sortA();
timer($i, 'sortA');
}
示例10: display_forum_tags
function display_forum_tags($info)
{
$locale = fusion_get_locale();
echo render_breadcrumbs();
if (isset($_GET['tag_id'])) {
// thread design
echo "<!--pre_forum-->\n";
echo "<div class='forum-title m-t-20'>" . $locale['forum_0341'] . "</div>\n";
echo "<div class='filter'>\n";
forum_filter($info);
echo "</div>\n";
if (!empty($info['threads']['pagenav'])) {
echo "<div class='text-right'>\n";
echo $info['threads']['pagenav'];
echo "</div>\n";
}
if (!empty($info['threads'])) {
echo "<div class='forum-container list-group-item'>\n";
if (!empty($info['threads']['sticky'])) {
foreach ($info['threads']['sticky'] as $cdata) {
render_thread_item($cdata);
}
}
if (!empty($info['threads']['item'])) {
foreach ($info['threads']['item'] as $cdata) {
render_thread_item($cdata);
}
}
echo "</div>\n";
} else {
echo "<div class='text-center'>" . $locale['forum_0269'] . "</div>\n";
}
if (!empty($info['threads']['pagenav'])) {
echo "<div class='text-right hidden-xs m-t-15'>\n";
echo $info['threads']['pagenav'];
echo "</div>\n";
}
if (!empty($info['threads']['pagenav2'])) {
echo "<div class='hidden-sm hidden-md hidden-lg m-t-15'>\n";
echo $info['threads']['pagenav2'];
echo "</div>\n";
}
} else {
?>
<div class="row m-0">
<?php
if (!empty($info['tags'])) {
?>
<?php
unset($info['tags'][0]);
?>
<?php
foreach ($info['tags'] as $tag_id => $tag_data) {
?>
<div class="col-xs-12 col-sm-4" style="height: 200px; max-height:200px; background-color: <?php
echo $tag_data['tag_color'];
?>
">
<a href="<?php
echo $tag_data['tag_link'];
?>
">
<div class="panel-body">
<h4 class="text-white"><?php
echo $tag_data['tag_title'];
?>
</h4>
<p class="text-white"><?php
echo $tag_data['tag_description'];
?>
</p>
</div>
<hr/>
<?php
if (!empty($tag_data['threads'])) {
?>
<span class="tag_result text-white">
<?php
echo trim_text($tag_data['threads']['thread_subject'], 10) . " - " . timer($tag_data['threads']['thread_lastpost']);
?>
</span>
<?php
}
?>
</a>
</div>
<?php
}
?>
<?php
}
?>
</div>
<?php
}
}
示例11: dirname
require dirname(__DIR__) . "/logic.php";
require __DIR__ . "/lib_mongodb.php";
require __DIR__ . "/autoload.php";
use model\User;
use model\Question;
use model\Answer;
$base_url = 'http://www.zhihu.com';
$ids = Question::getIds();
echo "there are ", count($ids), " questions to fetch\n";
$sum = $existing_sum = 1;
foreach ($ids as $qid) {
$url = "{$base_url}/question/{$qid}";
timer();
list($code, $content) = odie_get($url);
slog($url . " [{$code}]");
$t = timer();
echo "Fetch question {$qid} [{$code}] {$t} ms\n";
$username_list = get_username_list($content);
timer();
foreach ($username_list as $username => $nickname) {
echo "\t{$username}";
if (User::saveUser($username, $nickname)) {
$existing_sum++;
}
$sum++;
}
Question::setFetched($qid);
$rate = intval((1 - $existing_sum / $sum) * 100);
$t = timer();
echo "\tSave: {$t} ms\t Rate {$rate}%\n";
}
示例12: die
<?php
if (!defined('UC_SYSOP')) {
die('Direct access denied.');
}
show_blocks('d');
?>
<td valign="top" width="155">
<?php
show_blocks('r');
?>
</td>
<?php
// Variables for End Time
$seconds = timer() - $tstart;
$phptime = $seconds - $querytime;
$query_time = $querytime;
$percentphp = number_format($phptime / $seconds * 100, 2);
$percentsql = number_format($query_time / $seconds * 100, 2);
$seconds = substr($seconds, 0, 8);
// Хочешь убрать копирайт? (TBVERSION) - Поддержки разработчика, заплати! Не будь быдлом!
print "</td></tr></table>\n";
print "<table class=\"bottom\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\">\n";
print "<td width=\"49%\" class=\"bottom\"><div align=\"center\"><br /><b>" . TBVERSION . (BETA ? BETA_NOTICE : "") . "<br />" . sprintf($tracker_lang["page_generated"], $seconds, $queries, $percentphp, $percentsql) . "</b></div></td>\n";
print "</tr></table>\n";
print "</body></html>\n";
示例13: session_start
<?
// LTC WALLET
session_start();
include("functions.php");
$start = timer();
include("config.php");
include("bitcoin.inc");
include("address.inc");
include("recaptchalib.inc");
include ("adscaptchalib.inc");
//captha
$publickey = "6LfYSssSAAAAAF2w_TeMklmv-6VWUDhcECr9rWfI";
$privatekey = "6LfYSssSAAAAAPntQz9H0twbsdyk8kQHO_F4mupD";
// init
#$btclient = new bitcoinClient("http",$btclogin["username"],$btclogin["password"],$btclogin["host"],$btclogin["port"]);
#$addr = new Address($btclient,$sqlogin);
#$derp = $btclient->getinfo();
//Wallet by microwallet
$microwallet = new Microwallet('YOUR_API_KEY_HERE');
//$this->PDO_Conn = new PDO("mysql:host={$sqllogin['host']};dbname={$sqllogin['dbname']}", $sqllogin['username'], $sqllogin['password']);
$dbconn = mysql_connect($sqlogin['host'],$sqlogin['username'],$sqlogin['password']);
mysql_select_db($sqlogin['dbname']);
// time for pages ..
示例14: htmlentities
echo '<img style="margin: 0 0 -3px 0;border: 0px;" src="../files/blogs/anime_icon_' . $row['id'] . '.jpg" alt="" width="32" height="32"/> ';
echo '</td><td>';
echo '<a href="../blogs/index.php?act=view&id=' . $row['id'] . '">' . htmlentities($row['name'], ENT_QUOTES, 'UTF-8') . '</a> <br />(' . date('d.m.o / H:i', $row['time'] + $sdvigclock * 3600) . ')<br />';
echo '</td></tr></table>';
} else {
echo '<a href="../blogs/index.php?act=view&id=' . $row['id'] . '">' . htmlentities($row['name'], ENT_QUOTES, 'UTF-8') . '</a> (' . date('d.m.o / H:i', $row['time'] + $sdvigclock * 3600) . ')<br />';
}
echo '<div class="sub"></div>';
$text = $row['text'];
if (mb_strlen($text) > 100) {
$str = mb_substr($text, 0, 100);
$text = mb_substr($str, 0, mb_strrpos($str, ' ')) . '...';
}
echo functions::checkout($text, 2, 1);
if ($row['time'] > time()) {
echo '<div class="sub func">Waktu tersisa untuk disembunyikan: ' . timer($row['time'] - time()) . '</div>';
}
echo '</div>
<div class="bmenu"><a href="manage.php?act=newsedit&id=' . $row['id'] . '">Edit Blogs</a> | <a href="manage.php?act=delnews&id=' . $row['id'] . '">Delete</a></div>';
++$i;
}
echo '<div class="phdr">Total Blogs: ' . $total . '</div>';
if ($total > $kmess) {
echo '<p>' . functions::display_pagination('index.php?act=animes&mod=list&', $start, $total, $kmess) . '</p>';
echo '<p><form action="index.php" method="get">
<input type="hidden" name="act" value="mod_news"/>
<input type="hidden" name="mod" value="list"/>
<input type="text" name="page" size="2"/>
<input type="submit" value="' . $lng['to_page'] . ' >>"/></form></p>';
}
} else {
示例15: form_button
echo form_button('preview', $locale['articles_0240'], $locale['articles_0240'], array('class' => 'btn-default m-r-10'));
echo form_button('publish', $locale['articles_0242'], $locale['articles_0242'], array('class' => 'btn-primary m-r-10'));
echo form_button('delete', $locale['articles_0243'], $locale['articles_0243'], array('class' => 'btn-warning m-r-10'));
echo closeform();
}
}
}
} else {
$result = dbquery("SELECT\n\t\t\tts.submit_id, ts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_type='a' order by submit_datestamp desc\n\t\t\t");
$rows = dbrows($result);
if ($rows > 0) {
echo "<div class='well'>" . sprintf($locale['articles_0044'], format_word($rows, $locale['fmt_submission'])) . "</div>\n";
echo "<table class='table table-striped'>\n";
echo "<tr>\n";
echo "<th>" . $locale['articles_0041'] . "</th>\n<th>" . $locale['articles_0046'] . "</th><th>" . $locale['articles_0047'] . "</th><th>" . $locale['articles_0048'] . "</th>";
echo "</tr>\n";
echo "<tbody>\n";
while ($data = dbarray($result)) {
$submit_criteria = unserialize($data['submit_criteria']);
echo "<tr>\n";
echo "<td><a href='" . clean_request("submit_id=" . $data['submit_id'], array("section", "aid"), TRUE) . "'>" . $submit_criteria['article_subject'] . "</a></td>\n";
echo "<td>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "</td>\n";
echo "<td>" . timer($data['submit_datestamp']) . "</td>\n";
echo "<td>" . $data['submit_id'] . "</td>\n";
echo "</tr>\n";
}
echo "</tbody>\n</table>\n";
} else {
echo "<div class='well text-center m-t-20'>" . $locale['articles_0042'] . "</div>\n";
}
}