本文整理匯總了PHP中MicroTime函數的典型用法代碼示例。如果您正苦於以下問題:PHP MicroTime函數的具體用法?PHP MicroTime怎麽用?PHP MicroTime使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MicroTime函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DB_Query
function DB_Query($Query)
{
/******************************************************************************/
$__args_types = array('string');
#-------------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/******************************************************************************/
$Link =& Link_Get('DB');
#-------------------------------------------------------------------------------
if (!Is_Object($Link)) {
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Link = new MySQL($Config['DBConnection']);
#-------------------------------------------------------------------------------
if (Is_Error($Link->Open())) {
#-------------------------------------------------------------------------------
$Link = NULL;
#-------------------------------------------------------------------------------
return ERROR | @Trigger_Error('[DB_Query]: невозможно соединиться с базой данных');
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
if (Is_Error($Link->SelectDB())) {
#-------------------------------------------------------------------------------
$Link = NULL;
#-------------------------------------------------------------------------------
return ERROR | @Trigger_Error('[DB_Query]: невозможно выбрать базу данных');
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
list($Micro, $Seconds) = Explode(' ', MicroTime());
#-------------------------------------------------------------------------------
$StartTime = $Micro + $Seconds;
#-------------------------------------------------------------------------------
$Result = $Link->Query($Query);
#-------------------------------------------------------------------------------
list($Micro, $Seconds) = Explode(' ', MicroTime());
#-------------------------------------------------------------------------------
$EndTime = $Micro + $Seconds;
#-------------------------------------------------------------------------------
$GLOBALS['__TIME_MYSQL'] = $GLOBALS['__TIME_MYSQL'] + $EndTime - $StartTime;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error($Result)) {
return ERROR | @Trigger_Error('[DB_Query]: невозможно осуществить запрос');
}
#-------------------------------------------------------------------------------
$GLOBALS['__COUNTER_MYSQL']++;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return $Result;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
}
示例2: WriteToLog
function WriteToLog($txt, $level)
{
$this->logLevel = IntVal(COption::GetOptionString("mail", "smtp_log_level", "4"));
if ($this->logLevel < $level) {
return;
}
if (MicroTime(true) - $this->startPeriodTimeTruncate > 600) {
if ($this->logFile) {
FClose($this->logFile);
}
$this->logFile = null;
if (File_Exists($_SERVER["DOCUMENT_ROOT"] . $this->logFileName)) {
$logSize = @FileSize($_SERVER["DOCUMENT_ROOT"] . $this->logFileName);
$logSize = IntVal($logSize);
if ($logSize > $this->logMaxSize) {
if (($fp = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "rb")) && ($fp1 = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", "wb"))) {
$iSeekLen = IntVal($logSize - $this->logMaxSize / 2.0);
FSeek($fp, $iSeekLen);
@FWrite($fp1, "Truncated " . Date("Y-m-d H:i:s") . "\n---------------------------------\n");
do {
$data = FRead($fp, 8192);
if (StrLen($data) == 0) {
break;
}
@FWrite($fp1, $data);
} while (true);
@FClose($fp);
@FClose($fp1);
@Copy($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", $_SERVER["DOCUMENT_ROOT"] . $this->logFileName);
@UnLink($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_");
}
}
ClearStatCache();
}
$this->startPeriodTimeTruncate = MicroTime(true);
}
if (!$this->logFile || $this->logFile == null) {
$this->logFile = FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "a");
}
if (!$this->logFile) {
echo "Can't write to log\n---------------------------------\n";
return;
}
FWrite($this->logFile, Date("Y-m-d H:i:s") . "\t" . trim($txt) . "\n");
FFlush($this->logFile);
//if ($level > 4)
echo trim($txt) . "\n---------------------------------\n";
}
示例3: LoadSteam
public function LoadSteam($apiKey)
{
$this->Timers['Steam'] = MicroTime(true);
$steamSearchPlayers = array_chunk($this->Players, 100);
$builder = '';
$chunks = array();
$c = 0;
foreach ($steamSearchPlayers as $key => $value) {
foreach ($value as $k => $v) {
$builder .= $v->SteamId;
if (end($value) != $v) {
$builder .= ',';
} elseif (end($value) == $v) {
$chunks[] = $builder;
$builder = '';
}
}
}
$presponses = array();
$bresponses = array();
foreach ($chunks as $key => $value) {
if (empty($value)) {
continue;
}
// $curl = curl_init();
$baseUrl = 'https://api.steampowered.com/';
// var_dump($baseUrl."ISteamUser/GetPlayerSummaries/v0002/?key=$apiKey&steamids=$builder");
// exit;
// curl_setopt_array($curl, array(
// CURLOPT_RETURNTRANSFER => 1,
// CURLOPT_URL => $baseUrl."ISteamUser/GetPlayerSummaries/v0002/?key=$apiKey&steamids=$value",
// CURLOPT_SSL_VERIFYPEER => false,
// ));
// $profiles = curl_exec($curl);
$profiles = Async::call('file_get_contents', array($baseUrl . "ISteamUser/GetPlayerSummaries/v0002/?key={$apiKey}&steamids={$value}"));
$presponses = array_merge($presponses, json_decode((string) $profiles)->response->players);
// if (!$profiles) {
// die('Error: "'.curl_error($curl).'" - Code: '.curl_errno($curl));
// }
// curl_close($curl);
// $curl = curl_init();
// curl_setopt_array($curl, array(
// CURLOPT_URL => $baseUrl."ISteamUser/GetPlayerBans/v1/?key=$apiKey&steamids=$value",
// CURLOPT_RETURNTRANSFER => 1,
// CURLOPT_SSL_VERIFYPEER => false,
// ));
// $bans = curl_exec($curl);
$bans = Async::call('file_get_contents', array($baseUrl . "ISteamUser/GetPlayerBans/v1/?key={$apiKey}&steamids={$value}"));
$bresponses = array_merge($bresponses, json_decode((string) $bans)->players);
// if (!$bans) {
// die('Error: "'.curl_error($curl).'" - Code: '.curl_errno($curl));
// }
// curl_close($curl);
}
$this->LinkSteamProfiles($presponses);
$this->LinkSteamBans($bresponses);
$this->SteamLoaded = true;
$this->Timers['Steam'] = Number_Format(MicroTime(true) - $this->Timers['Steam'], 4, '.', '');
}
示例4: uuid
/**
* Return a 32 bit unique ID
*
* @method string uuid()
* @access public
* @return string
*
* @author Brian Tafoya
* @copyright Copyright 2001 - 2015, Brian Tafoya.
* @version 1.0
*/
public function uuid()
{
return (string) md5(uniqid(rand() + MicroTime(), 1));
}
示例5: switch
switch (ValueOf($PDF)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'string':
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Formats/Contract/Number', $Contract['ID']);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$File = SPrintF('Contract_%s.pdf', Md5(MicroTime()));
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/files/%s', $Tmp, $File), $PDF, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
return array('Status' => 'Ok', 'Location' => SPrintF('/GetTemp?File=%s&Name=Contract%s.pdf&Mime=application/pdf', $File, $Comp));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
示例6: GetMicroTime
FUNCTION GetMicroTime($time = 0) {
IF(!$time)
{$time = MicroTime();}
List($usec, $sec) = Explode(" ", $time);
RETURN ((float)$usec + (float)$sec);
}
示例7: isset
// $smarty->assign('bookstyl', isset($_SESSION['bookstyl']) ? $_SESSION['bookstyl'] :'');
$smarty->assign('fook', isset($_SESSION['fook']) ? $_SESSION['fook'] : '');
$smarty->assign('mail_notify', isset($_SESSION['mail_notify']) ? $_SESSION['mail_notify'] : '');
$smarty->assign('friend', isset($_SESSION['friend']) ? $_SESSION['friend'] : '');
$smarty->assign('friends', isset($_SESSION['friend']) ? $_SESSION['friend'] : '');
$smarty->assign('anticsrf', isset($_SESSION['anticsrf']) ? $_SESSION['anticsrf'] : NULL);
$smarty->assign('_POST', isset($_POST) ? $_POST : '');
//XXX
$smarty->assign('cube_vector', $_SESSION['cube_vector']);
// $new_mail = $newmailset->getInt('user_mail');
// if ($new_mail > 0)
// $smarty->assign('new_mail', $new_mail);
// $smarty->assign('new_mail_name', $newmailset->getString('mail_sender'));
// $smarty->assign('user_k', $newmailset->getInt('user_k'));
// $smarty->assign('k_wallet', $newmailset->getInt('k_wallet'));
}
error_log("LOG: event: {$event}, node_id: {$node_id}, template_id: {$template_id}");
require_once INCLUDE_DIR . "eventz/{$event}.inc";
// Event is executed, now get $referer_id
$referer_id = "";
if (preg_match('/id\\/(\\d+)/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) {
$referer_id = $match[1];
} elseif (preg_match('/name\\/(.*?)\\/?$/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) {
$referer_id = nodes::getNodeIdByName($match[1]);
}
// creating neural network + updating node counters
nodes::update_nodes(isset($_SESSION['user_id']) ? $_SESSION['user_id'] : "", $node_id, $referer_id);
$time = substr(Time() + substr(MicroTime(), 0, 8) - $timer_start, 0, 7);
$smarty->assign('generation_time', $time);
echo $content;
// end of displaying
示例8: __ShutDown_Function__
/**
* Custom shutdown function.
*/
function __ShutDown_Function__()
{
#-------------------------------------------------------------------------------
// Catch Fatal Errors.
$lastError = error_get_last();
#-------------------------------------------------------------------------------
if ($lastError != NULL) {
#-------------------------------------------------------------------------------
$Message = SPrintF('[%s]-%s в линии %s файла %s', $lastError['type'], $lastError['message'], $lastError['line'], $lastError['file']);
#-------------------------------------------------------------------------------
Debug(SPrintF('[!] %s', $Message));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
# added by lissyara 2011-10-12 in 16:15 MSK, for JBS-173
#Debug("[JBs core]:" . print_r($GLOBALS, true));
list($Micro, $Seconds) = Explode(' ', MicroTime());
#-------------------------------------------------------------------------------
$WorkTimeTmp = (double) $Micro + (double) $Seconds - START_TIME;
#-------------------------------------------------------------------------------
$UserData = array('CreateDate' => Time(), 'UserID' => isset($GLOBALS['__USER']) ? $GLOBALS['__USER']['ID'] : 10, 'REMOTE_ADDR' => isset($GLOBALS['_SERVER']['REMOTE_ADDR']) ? $GLOBALS['_SERVER']['REMOTE_ADDR'] : '', 'REQUEST_URI' => isset($GLOBALS['_SERVER']['REQUEST_URI']) ? $GLOBALS['_SERVER']['REQUEST_URI'] : '', 'HTTP_REFERER' => isset($GLOBALS['_SERVER']['HTTP_REFERER']) ? $GLOBALS['_SERVER']['HTTP_REFERER'] : '', 'HTTP_USER_AGENT' => isset($GLOBALS['_SERVER']['HTTP_USER_AGENT']) ? $GLOBALS['_SERVER']['HTTP_USER_AGENT'] : '', 'WORK_TIME' => $WorkTimeTmp, 'TIME_MYSQL' => $GLOBALS['__TIME_MYSQL'], 'COUNTER_MYSQL' => $GLOBALS['__COUNTER_MYSQL'], 'COUNTER_COMPS' => $GLOBALS['__COUNTER_COMPS']);
#-------------------------------------------------------------------------------
if ($GLOBALS['_SERVER']['REQUEST_URI'] != '/API/Events') {
#-------------------------------------------------------------------------------
$IsInsert = DB_Insert('RequestLog', $UserData);
if (Is_Error($IsInsert)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
list($Micro, $Seconds) = Explode(' ', MicroTime());
#-------------------------------------------------------------------------------
if (!Define('WORK_TIME', (double) $Micro + (double) $Seconds - START_TIME)) {
exit('[JBs core]: не удалось определить константу (WORK_TIME)');
}
#-------------------------------------------------------------------------------
Debug(SPrintF('[JBs core]: система работала: %s', WORK_TIME));
#-------------------------------------------------------------------------------
# added by lissyara, 2011-10-11 in 15:27 MSK
Debug(SPrintF('[JBs core]: время работы MySQL: %s [%s%%]', $GLOBALS['__TIME_MYSQL'], Round($GLOBALS['__TIME_MYSQL'] / WORK_TIME * 100, 2)));
#-------------------------------------------------------------------------------
Debug(SPrintF('[JBs core]: запросов к MySQL: %u', $GLOBALS['__COUNTER_MYSQL']));
#-------------------------------------------------------------------------------
Debug(SPrintF('[JBs core]: загружено компонентов: %u', $GLOBALS['__COUNTER_COMPS']));
#-------------------------------------------------------------------------------
Debug('');
Debug('');
Debug('');
Debug('');
#-------------------------------------------------------------------------------
}
示例9: GetApexStatus
<li><a href="#" onclick="javascript:window.location='?page=carpark'"><i class="icon-fire"></i> Vozový park hráèe</a></li>
<li><a href="#"><i class="icon-play-circle"></i> <b>Apex</b> : <?php
echo GetApexStatus();
?>
</a></li>
<li><a href="#"><i class="icon-play-circle"></i> <b>Chicane</b> : <?php
echo GetChicaneStatus();
?>
</a></li>
</ul>
</div>
</div>
<?php
PageSystem();
?>
<div class="span10 tabulka"></div>
<div id="bottom" class="span10 " style="font-size:small;background-color:white;" >
<table class="table table-striped">
<tbody>
<tr>
<td style="text-align:left;"><span class="badge badge-important">Ewolutions.cz © 2012</span></td>
<td style="text-align:right;"><span class="badge badge-success" >Vygenerováno za <?php
echo Number_Format(MicroTime(true) - $Timer, 4, '.', '') * 1000;
?>
ms</span></td>
</tr>
</tbody>
<table>
</div>
</body>
</html>
示例10: SPrintF
}
$File = SPrintF('%s/Config.xml', $Folder);
$Data = <<<EOD
<XML>
<DBConnection>
<User>%s</User>
<Password>%s</Password>
<DbName>%s</DbName>
<Server>%s</Server>
<Port>%s</Port>
</DBConnection>
<EncryptionKey>%s</EncryptionKey>
<CSRFKey>%s</CSRFKey>
</XML>
EOD;
if (File_Put_Contents($File, SPrintF($Data, $__SETTINGS['db-user'], $__SETTINGS['db-password'], $__SETTINGS['db-name'], $__SETTINGS['db-server'], $__SETTINGS['db-port'], Str_Shuffle(Md5(MicroTime() . Rand(0, 1000000))), Str_Shuffle(Md5(MicroTime() . Rand(0, 1000000)))))) {
Message('Настройки конфигурации успешно сохранены');
if (!chmod($File, 0600)) {
Error(SPrintF('Не удалось поставить права 0600 на файл конфигурации (%s)', $File));
} else {
Message(SPrintF('Права 0600 на файл конфигурации (%s) успешно установлены.', $File));
# пропускаем стадию с рассказом про триггеры и предложением их установки
#$__STEP_ID = 5;
$__STEP_ID = 6;
}
} else {
Error(SPrintF('Не возможно создать файл конфигурации (%s)', $File));
}
}
}
#-------------------------------------------------------------------------------
示例11: SubStr
else {
if (is_numeric($template_id) or strpos(";",$template_id)) {
require(SYSTEM_ROOT.'/inc/actions.inc');
$content.=$smarty->fetch($node['node_type'].".tpl");
}
elseif (empty($template_id)) {
$content.=$smarty->fetch($node['node_type'].".tpl");
}
else {
$content.=$smarty->fetch($template_id.".tpl");
}
}
}
*/
$smarty->template_dir = OWN_TEMPLATE_DIR;
if (is_numeric($template_id)) {
$content .= $smarty->fetch($template_id . ".tpl");
} else {
$content .= $smarty->fetch($node['template_id'] . ".tpl");
}
$time = SubStr(Time() + SubStr(MicroTime(), 0, 8) - $timer_start, 0, 7);
echo $content;
echo "<center>page generation took: {$time} second</center>";
$query = "insert delayed into load_times values (now(), '{$time}')";
//$db->executequery($query);
//end of displaying
// dake vypisi pre kybu
if ($_SESSION['user_id'] == 342) {
}
示例12: SubStr
<?php
include "loginbox.inc";
?>
<?php
include "navbox.inc";
?>
<?php
include "mame_radi_box.inc";
?>
</td>
</tr>
<tr><td colspan=3><td align=right><?php
include "next.inc";
?>
<tr><td colspan=6 align=center><?php
//include("z.inc");
?>
</td></tr>
<?php
}
//vypis casu tvorby stranky
echo "<tr><td colspan=9 align='center'>" . SubStr(Time() + SubStr(MicroTime(), 0, 8) - $timer_start, 0, 7) . "</td></tr>";
?>
<tr><td colspan=9 align=center><?php
include "tiraz.inc";
?>
</td></tr>
</table>
</table>
</body>
</html>
示例13: MicroTime
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
VerliAdmin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with VerliAdmin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
=========================================================================
*/
$script_start = MicroTime(); //Get microtime on start of script
OB_Start(); //Start output buffering
$mysql = Parse_Ini_File("config.php", TRUE);
$browser = substr($_SERVER['HTTP_USER_AGENT'], 0, 7);
IF(isset($_POST['selecthub']) && $mysql['HUB']['multi']==1)
{
setcookie("database",$_POST['HubDB']);
$database=$_POST['HubDB'];
}
ELSEIF(!$database && $mysql['HUB']['multi']==1) Print "<SCRIPT language=\"javascript\"><!--
location.replace(\"selectdb.php\");
示例14: DB_Query
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Result = DB_Query(SPrintF('OPTIMIZE TABLE `%s`', $TableID));
if (Is_Error($Result)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Rows = MySQL::Result($Result);
if (Is_Error($Rows)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Row = Current($Rows);
#-------------------------------------------------------------------------------
$TimeEnd = Explode(" ", MicroTime());
#-------------------------------------------------------------------------------
$TimeExecute = $TimeEnd[0] + $TimeEnd[1] - $TimeStart[0] - $TimeStart[1];
#-------------------------------------------------------------------------------
Debug(SPrintF('[comp/Tasks/BackUp]: Время на таблицу: %s; результат оптимизации таблицы (%s) (%s)=[%s]', Round($TimeExecute, 3), $TableID, $Row['Msg_type'], $Row['Msg_text']));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$DBConnection = $Config['DBConnection'];
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例15: JSON_Encode
#---------------------------------------------------------------------------
echo JSON_Encode($Answer);
break;
case 'false':
echo JSON_Encode(array('Status' => 'FALSE'));
break;
case 'true':
echo JSON_Encode(array('Status' => 'TRUE'));
break;
case 'array':
$Result = JSON_Encode($Result);
case 'string':
#---------------------------------------------------------------------------
if (!Headers_Sent()) {
#-------------------------------------------------------------------------
list($Micro, $Seconds) = Explode(' ', MicroTime());
#-------------------------------------------------------------------------
Header(SPrintF('Waiting-Time: %01.2f sec', (double) $Micro + (double) $Seconds - START_TIME));
#-------------------------------------------------------------------------
$Size = MB_StrLen($Result, 'ASCII');
#-------------------------------------------------------------------------
if ($Size > 30720 && Preg_Match('/gzip/', (string) @$_SERVER['HTTP_ACCEPT_ENCODING'])) {
#-----------------------------------------------------------------------
Header(SPrintF('Real-Content-Length: %u', $Size));
#-----------------------------------------------------------------------
$Result = GzEncode($Result);
#-----------------------------------------------------------------------
Header('Content-Encoding: gzip');
Header(SPrintF('Content-Length: %u', MB_StrLen($Result, 'ASCII')));
}
}