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


PHP get_microtime函数代码示例

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


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

示例1: query

 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         return false;
     }
 }
开发者ID:vebnz,项目名称:lifelitup,代码行数:26,代码来源:mysql.php

示例2: ptime

function ptime()
{
    global $time_start;
    $time_end = get_microtime();
    $ptime = $time_end - $time_start;
    return substr($ptime, 0, 8);
}
开发者ID:dalinhuang,项目名称:c2my,代码行数:7,代码来源:common.inc.php

示例3: query

 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     $this->last_query = $sql;
     if (defined('LUNA_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     $this->query_result = $this->link_id->query($sql);
     if ($this->query_result) {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = $this->link_id->lastErrorCode();
         $this->error_msg = $this->link_id->lastErrorMsg();
         if ($this->in_transaction) {
             $this->link_id->exec('ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:29,代码来源:sqlite3.php

示例4: query

 function query($query, $bypass_error = FALSE, $unbufferd = false)
 {
     $this->querytime = get_microtime();
     $this->query_result = $this->connect_id->query($query, $unbufferd ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);
     if ($this->query_result) {
         return $this->query_result;
     } else {
         if (($this->connect_id->errno == 1030 && strpos($this->connect_id->error, '127') || $this->connect_id->errno == 1034 || $this->connect_id->errno == 1035) && preg_match('#(INTO|FROM)\\s+([a-z_]+)#i', $query, $match) && $this->connect_id->query('REPAIR TABLE ' . $match[2])) {
             $this->query_result = $this->connect_id->query($query, $unbufferd ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);
             if ($this->query_result) {
                 return $this->query_result;
             }
         } else {
             if ($this->connect_id->errno == 1062 && preg_match('#ALTER\\s+TABLE\\s+([a-z_]+)\\s+ADD\\s+PRIMARY\\s+KEY\\s+\\(([a-z_]+)\\)#i', $query, $table) && preg_match("#Duplicate\\s+entry\\s+'(.*)'\\s+for\\s+key#i", $this->connect_id->error, $entry) && $this->connect_id->query("DELETE FROM {$table['1']} WHERE {$table['2']} LIKE '{$entry['1']}%' LIMIT " . ($this->connect_id->query("SELECT {$table['2']} FROM {$table['1']} WHERE {$table['2']} LIKE '{$entry['1']}%'")->num_rows - 1)) || $this->connect_id->errno == 1062 && preg_match('#CREATE\\s+UNIQUE\\s+INDEX\\s+([a-z_]+)\\s+ON\\s+([a-z_]+)\\s+\\(([a-z_]+)\\)#i', $query, $table) && preg_match("#Duplicate\\s+entry\\s+'(.*)'\\s+for\\s+key#i", $this->connect_id->error, $entry) && $this->connect_id->query("DELETE FROM {$table['2']} WHERE {$table['3']} LIKE '{$entry['1']}%' LIMIT " . ($this->connect_id->query("SELECT {$table['3']} FROM {$table['2']} WHERE {$table['3']} LIKE '{$entry['1']}%'")->num_rows - 1))) {
                 return $this->query($query, $bypass_error, $unbufferd);
             } else {
                 if ($this->connect_id->errno == 1007 && preg_match('#CREATE\\s+DATABASE\\s+#i', $query)) {
                     return true;
                 }
             }
         }
     }
     if ($bypass_error) {
         return NULL;
     } else {
         $this->show_error("While executing query \"{$query}\"\n\nthe following error occured: " . $this->connect_id->error);
     }
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:28,代码来源:mysqli.php

示例5: query

 function query($sql, $unbuffered = false)
 {
     if (defined('PUN_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @mysql_errno($this->link_id);
         $this->error_msg = @mysql_error($this->link_id);
         return false;
     }
 }
开发者ID:highpictv,项目名称:forum,代码行数:25,代码来源:mysql.php

示例6: query

 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('OPENLD_SHOW_QUERIES')) {
         $q_start = microtime_float();
     }
     $this->query_result = @mysqli_query($this->link_id, $sql);
     if ($this->query_result) {
         if (defined('OPENLD_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('OPENLD_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         // Rollback transaction
         if ($this->in_transaction) {
             mysqli_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:Dawzz,项目名称:Open-Link-Directory,代码行数:27,代码来源:mysqli_innodb.php

示例7: build

 /**
  * Make sure that the model is configured with a valid URL.
  *
  * @return string json
  */
 function build()
 {
     if ($site_id = $this->config('site_id')) {
         $s = get_microtime();
         $es = new entity_selector();
         $es->add_type(id_of('social_account_type'));
         $es->add_right_relationship($site_id, relationship_id_of('site_to_social_account'));
         $es->add_rel_sort_field($site_id, relationship_id_of('site_to_social_account'));
         $es->set_order('rel_sort_order ASC');
         $es->limit_tables();
         $es->limit_fields();
         if ($results = $es->run_one()) {
             $result_keys = array_keys($results);
             $sih = reason_get_social_integration_helper();
             foreach ($result_keys as $id) {
                 // get the integrator if it supports the SocialAccountProfileLinks interface
                 if ($integrator = $sih->get_social_account_integrator($id, 'SocialAccountProfileLinks')) {
                     $profile_links[$id]['icon'] = $integrator->get_profile_link_icon($id);
                     $profile_links[$id]['text'] = $integrator->get_profile_link_text($id);
                     $profile_links[$id]['href'] = $integrator->get_profile_link_href($id);
                 }
             }
             if (!empty($profile_links)) {
                 return $profile_links;
             }
         }
         return false;
     } else {
         trigger_error('The ReasonSocialProfileLinksModel must be provided with the configuration parameter site_id.', FATAL);
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:36,代码来源:profile_links.php

示例8: query

 function query($sql, $unbuffered = false)
 {
     if (defined('LUNA_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @sqlite_unbuffered_query($this->link_id, $sql);
     } else {
         $this->query_result = @sqlite_query($this->link_id, $sql);
     }
     if ($this->query_result) {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('LUNA_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @sqlite_last_error($this->link_id);
         $this->error_msg = @sqlite_error_string($this->error_no);
         if ($this->in_transaction) {
             @sqlite_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:29,代码来源:sqlite.php

示例9: query

 public function query($sql, $unbuffered = false)
 {
     if (defined('FEATHER_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     $this->query_result = @mysqli_query($this->link_id, $sql);
     if ($this->query_result) {
         if (defined('FEATHER_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FEATHER_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @mysqli_errno($this->link_id);
         $this->error_msg = @mysqli_error($this->link_id);
         // Rollback transaction
         if ($this->in_transaction) {
             mysqli_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:26,代码来源:mysqli_innodb.php

示例10: query

 function query($sql, $unbuffered = false)
 {
     if (strrpos($sql, 'LIMIT') !== false) {
         $sql = preg_replace('#LIMIT ([0-9]+),([ 0-9]+)#', 'LIMIT \\2 OFFSET \\1', $sql);
     }
     if (defined('PUN_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     @pg_send_query($this->link_id, $sql);
     $this->query_result = @pg_get_result($this->link_id);
     if (pg_result_status($this->query_result) != PGSQL_FATAL_ERROR) {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         $this->last_query_text[$this->query_result] = $sql;
         return $this->query_result;
     } else {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = false;
         $this->error_msg = @pg_result_error($this->query_result);
         if ($this->in_transaction) {
             @pg_query($this->link_id, 'ROLLBACK');
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:highpictv,项目名称:forum,代码行数:30,代码来源:pgsql.php

示例11: query

 public function query($sql, $memcache = false, $memcache_timeout = false)
 {
     if (!$this->useMemcache) {
         $memcache = false;
     }
     $start = get_microtime();
     $memcache_check = false;
     if ($memcache) {
         $result = $this->memcache->get($memcache, null, true);
         if ($result) {
             $memcache_check = true;
         }
     }
     if (!$memcache_check) {
         if (!$this->instance) {
             $this->connect();
         }
         $result = $this->instance->query($sql);
     }
     $end = get_microtime();
     if (!$result) {
         die("MySQL Error: " . $this->instance->error);
     }
     $log = array();
     $log['query'] = $sql;
     $log['time'] = number_format(round(($end - $start) * 1000, 4), 4);
     if ($memcache) {
         if ($memcache_check) {
             $log['memcache'] = 'get';
         } else {
             $log['memcache'] = 'add';
         }
     } else {
         $log['memcache'] = false;
     }
     array_push($this->query_log, $log);
     if ($memcache_check) {
         return $result;
     }
     if (strtoupper(substr(trim($sql), 0, 6)) == "SELECT") {
         $return_array = array();
         $return_array['result'] = array();
         $return_array['count'] = $result->num_rows;
         while ($row = $result->fetch_assoc()) {
             array_push($return_array['result'], $row);
         }
         if ($memcache) {
             $this->memcache->add($memcache, $return_array, false, $memcache_timeout ? $memcache_timeout : 0, true);
         }
         return $return_array;
     } elseif (strtoupper(substr(trim($sql), 0, 6)) == "INSERT") {
         return $this->instance->insert_id;
     } elseif (strtoupper(substr(trim($sql), 0, 6)) == "UPDATE") {
         return $this->instance->affected_rows;
     } else {
         return true;
     }
 }
开发者ID:noother,项目名称:NoothWork,代码行数:58,代码来源:MySQL.php

示例12: Saafooter

/**
* Footer
*
* To show footer of any page you want 
* paramenters : none
*/
function Saafooter($outscript = false)
{
    global $tpl, $SQL, $starttm, $config, $usrcp, $lang, $olang;
    global $do_gzip_compress, $script_encoding, $errorpage, $extras, $userinfo;
    //show stats ..
    $page_stats = '';
    if ($config['statfooter'] != 0) {
        $gzip = $config['gzip'] == '1' ? "Enabled" : "Disabled";
        $hksys = !defined('STOP_HOOKS') ? "Enabled" : "Disabled";
        $endtime = get_microtime();
        $loadtime = number_format($endtime - $starttm, 4);
        $queries_num = $SQL->query_num;
        $time_sql = round($SQL->query_num / $loadtime);
        $page_url = preg_replace(array('/([\\&\\?]+)debug/i', '/&/i'), array('', '&'), kleeja_get_page());
        $link_dbg = user_can('enter_acp') && $config['mod_writer'] != '1' ? '[ <a href="' . str_replace('&', '&amp;', $page_url) . (strpos($page_url, '?') === false ? '?' : '&amp;') . 'debug">More Details ... </a> ]' : null;
        $page_stats = "<strong>[</strong> GZIP : {$gzip} - Generation Time: {$loadtime} Sec  - Queries: {$queries_num} - Hook System:  {$hksys} <strong>]</strong>  " . $link_dbg;
    }
    $tpl->assign("page_stats", $page_stats);
    //if admin, show admin in the bottom of all page
    $tpl->assign("admin_page", user_can('enter_acp') ? '<a href="' . ADMIN_PATH . '" class="admin_cp_link"><span>' . $lang['ADMINCP'] . '</span></a>' : '');
    //assign cron
    $tpl->assign("run_queue", '<img src="' . $config['siteurl'] . 'go.php?go=queue" width="1" height="1" alt="queue" />');
    // if google analytics, new version
    //http://www.google.com/support/googleanalytics/bin/answer.py?answer=55488&topic=11126
    $googleanalytics = '';
    if (strlen($config['googleanalytics']) > 4) {
        $googleanalytics .= '<script type="text/javascript">' . "\n";
        $googleanalytics .= '<!--' . "\n";
        $googleanalytics .= 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");' . "\n";
        $googleanalytics .= 'document.write("\\<script src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'>\\<\\/script>" );' . "\n";
        $googleanalytics .= '-->' . "\n";
        $googleanalytics .= '</script>' . "\n";
        $googleanalytics .= '<script type="text/javascript">' . "\n";
        $googleanalytics .= '<!--' . "\n";
        $googleanalytics .= 'var pageTracker = _gat._getTracker("' . $config['googleanalytics'] . '");' . "\n";
        $googleanalytics .= 'pageTracker._initData();' . "\n";
        $googleanalytics .= 'pageTracker._trackPageview();' . "\n";
        $googleanalytics .= '-->' . "\n";
        $googleanalytics .= '</script>' . "\n";
    }
    $tpl->assign("googleanalytics", $googleanalytics);
    //check for extra header
    if (empty($extras['footer'])) {
        $extras['footer'] = false;
    }
    ($hook = kleeja_run_hook('func_Saafooter')) ? eval($hook) : null;
    //run hook
    $footer = $tpl->display("footer");
    ($hook = kleeja_run_hook('Saafooter_func')) ? eval($hook) : null;
    //run hook
    echo $footer;
    //page analysis
    if (isset($_GET['debug']) && user_can('enter_acp')) {
        kleeja_debug();
    }
    //at end, close sql connections
    $SQL->close();
}
开发者ID:Saleh7,项目名称:Kleeja,代码行数:64,代码来源:functions_display.php

示例13: print_version

function print_version()
{
    global $time_start, $gzip, $PRINT_DEBUG, $tracker_version;
    $time_end = get_microtime();
    $max_mem = memory_get_peak_usage();
    print "<p align='center'>";
    if ($PRINT_DEBUG) {
        print "<small>[ Execution Time: " . number_format($time_end - $time_start, 4) . " sec. ] - [Memcached Queries: " . MCached::$count . " (" . round(MCached::$time, 4) . " sec.)] - [Memory Usage: " . misc::makesize($max_mem) . "]</small><br />";
    }
    print "BtiTracker (" . $tracker_version . ") by <a href='https://github.com/Yupy/BtiTracker-1.5.1' target='_blank'>Yupy</a> & <a href='http://www.btiteam.org' target='_blank'>Btiteam</a></p>";
}
开发者ID:Q8HMA,项目名称:BtiTracker-1.5.1,代码行数:11,代码来源:functions.php

示例14: render_page

function render_page($license = false)
{
    global $aidlink, $locale, $settings, $colour_switcher, $fontsize_switcher, $main_style;
    echo "\n\t<div id='main' style='width: " . THEME_WIDTH . ";'>\n\t\t<div id='uborder' class='clearfix'>\n\t\t\t<div id='ucornerl' class='flleft'></div>\n\t\t\t<div id='ucornerr' class='flright'></div>\n\t\t</div>\n\t\t<div id='borderr'>\n\t\t\t<div id='borderl'>\n\t\t\t\t<div id='cont' class='clearfix {$main_style}'>\n\t\t\t\t\t<div id='userbar' class='floatfix'>\n\t\t\t\t\t\t<ul id='anchors' class='flleft'><li><a href='#Content'>" . $locale['global_210'] . "</a></li></ul>\n\t\t\t\t\t\t<ul id='links' class='clearfix flright'>\n";
    if (iMEMBER) {
        echo "\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "edit_profile.php'>" . $locale['global_120'] . "</a></li>\n\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "messages.php'>" . $locale['global_121'] . "</a></li>\n\t\t\t\t\t\t\t" . (iADMIN ? "<li><a href='" . ADMIN . "index.php" . $aidlink . "' >" . $locale['global_123'] . "</a></li>" : "") . "\n\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "setuser.php?logout=yes'>" . $locale['global_124'] . "</a></li>\n";
    } else {
        echo "\t\t\t\t\t\t\t<li><a href='" . BASEDIR . "login.php'>" . $locale['global_104'] . "</a></li>\n\t\t\t\t\t\t\t" . ($settings['enable_registration'] ? "<li><a href='" . BASEDIR . "register.php'>" . $locale['global_107'] . "</a></li>\n" : "");
    }
    echo "\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id='mainheader' class='clearfix'>" . showbanners() . "</div>\n\t\t\t\t\t<div id='subheader' class='clearfix'>" . preg_replace("^(li)( class='(first-link)')*(><a href='(\\.\\./)*" . preg_quote(START_PAGE) . "')^i", "\\1 class='active \\3'\\4", showsublinks("")) . "\n\t\t\t\t\t\t" . $colour_switcher->makeForm("flright") . " \n\t\t\t\t\t\t" . $fontsize_switcher->makeForm("flright") . "\n\t\t\t\t\t</div>\n\t\t\t\t\t" . (LEFT ? "<div id='side-border-left'>" . LEFT . "</div>" : "") . "\n\t\t\t\t\t" . (RIGHT ? "<div id='side-border-right'>" . RIGHT . "</div>" : "") . "\n\t\t\t\t\t<div id='main-bg'><div id='container'>" . U_CENTER . CONTENT . L_CENTER . "\n\t\t\t\t\t</div></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id='lborder'>\n\t\t\t<div id='lcornerl' class='flleft'></div>\n\t\t\t<div id='lcornerr' class='flright'></div>\n\t\t</div>\n\t\t<div id='footer' class='clearfix'>\n\t\t\t" . (!$license ? "<div class='flleft' style='width: 50%'>" . showcopyright() . "<br />\n Theme designed by <a href='http://matonor.com'>Max Toball</a></div>" : "") . "\n\t\t\t<div class='flright' style='width: 50%; text-align: right;'>" . stripslashes($settings['footer']) . "</div>\n\t\t</div>\n\t\t<div id='subfooter' class='clearfix'>\n\t\t\t<div class='flleft' style='width: 50%'>" . sprintf($locale['global_172'], substr(get_microtime() - START_TIME, 0, 4)) . "</div>\n\t\t\t<div class='flright' style='width: 50%; text-align: right;'>" . showcounter() . "</div>\n\t\t</div>\n\t</div>";
}
开发者ID:dioda,项目名称:phpfusion,代码行数:11,代码来源:theme.php

示例15: print_version

function print_version()
{
    global $time_start, $gzip, $PRINT_DEBUG, $tracker_version;
    $time_end = get_microtime();
    $max_mem = memory_get_peak_usage();
    print "<p align='center'>";
    if ($PRINT_DEBUG) {
        print "[ Execution time: " . number_format($time_end - $time_start, 4) . " sec. ] - [Memory usage: " . misc::makesize($max_mem) . "] - [ GZIP: " . $gzip . " ]<br />";
    }
    print "BtiTracker (" . $tracker_version . ") by <a href='https://github.com/Yupy/BtiTracker-1.5.0' target='_blank'>Yupy</a> & <a href='http://www.btiteam.org' target='_blank'>Btiteam</a></p>";
}
开发者ID:HDVinnie,项目名称:BtiTracker-1.5.0,代码行数:11,代码来源:functions.php


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