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


PHP mtime函数代码示例

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


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

示例1: timer

function timer($testName)
{
    global $t0;
    echo $testName . " 所需时间为 ";
    echo mtime() - $t0;
    echo " 毫秒<br>\n";
}
开发者ID:nldfr219,项目名称:zhi,代码行数:7,代码来源:db_test.php

示例2: send

function send()
{
    global $keystring, $login, $email;
    $hash = md5('#RANDOM_PREFIX#' . mtime() . '#RANDOM_SEPARATOR#' . $login . '#WITH#' . $email . '#RANDOM_SUFFIX#');
    if ($_SESSION['CAPTCHA_Keystring'] == '' || strtolower($keystring) != $_SESSION['CAPTCHA_Keystring']) {
        add_info('Вы не прошли тест Тьюринга на подтверждение того, что вы не бот.');
        return false;
    }
    $r = db_row_value('user', "(`login` =\"{$login}\") AND (`email`=\"{$email}\") AND (`authorized`=1)");
    if ($r['id'] == '') {
        add_info('Неверное сочетание login <-> email');
        return false;
    }
    $s = unserialize($r['settings']);
    if ($s['restore_timestamp'] && time() - $s['restore_timestamp'] < config_get('restore-timeout')) {
        add_info('Вы не можете просить восстановку пароля так часто');
        return false;
    }
    $s['restore_hash'] = $hash;
    $s['restore_timestamp'] = time();
    db_update('user', array('settings' => db_string(serialize($s))), '`id`=' . $r['id']);
    $link = config_get('http-document-root') . '/login/restore/confirm/?id=' . $r['id'] . '&hash=' . $hash;
    sendmail_tpl(stripslashes($email), 'Восстановление пароля в системе ' . config_get('site-name'), 'restore', array('login' => stripslashes($login), 'email' => stripslashes($email), 'link' => $link));
    return true;
}
开发者ID:Nazg-Gul,项目名称:gate,代码行数:25,代码来源:data.php

示例3: mtime

	if (file_exists("adm/$process.php")) {
	include "adm/$process.php";
	}
}



if ($process == "word") {
function mtime(){
    list($usec, $sec) = explode(" ",microtime());
    return ((float)$usec + (float)$sec);
    }
$basla = mtime();
for ($i=0; $i < 10000; $i++){
    }
$bitir = mtime();
echo "<br><br><br><center><a href=sozluk.php?process=word&q=Haliç+Sözlük target=main><font size=1>Haliç Sözlük entertaintment</font></a>";

echo "
<hr>
<div class='copyright' align='center'>Haliç Sözlük</DIV><br>

<font size=1><a href=sozluk.php?process=word&q=Haliç+Sözlük target=main><font size=1>&copy; 2009 - 2010 Haliç Sözlük</font></a> | <a href=http://www.halicsozluk.com/xml/today.xml target=main><font size=1>Haliç Sözlük RSS</font></a> | Kuruluþ : 10.11.2009<br>
sözlükte olan herþey yalan olabilir. haliç sözlük içeriði herhangi bir ön denetimden geçmeksiniz olduðu gibi yayýnlanýr ve doðrulu garanti edilmemektedir. <br>her yazar kendi bacaðýndan asýlýr, kimse bizi baðlamaz. sözlükte bulunan her satýr yazarlarýna aittir. araklanmasý yada kaynak gösterilmeden yayýnlanmasý yasaktýr. kaynak gösterilerek ticari olmayan yerlerde yayýnlanabilir.<br>

";
}

}
ob_end_flush();
?>
开发者ID:halitartuc,项目名称:sozluk,代码行数:31,代码来源:sozluk2.php

示例4: mtime

<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id: get.php 577 2006-05-29 12:04:06Z buddhafly $
 * Created for the StreamOnTheFly project (IST-2001-32226)
 * Authors: Andr�s Micsik, M�t� Pataki, Tam�s D�ri 
 *          at MTA SZTAKI DSD, http://dsd.sztaki.hu
 */
require "init.inc.php";
$starttime = mtime();
//$smarty->assign("OKURL", $_SERVER['PHP_SELF'] . "?id=" . rawurlencode($id));
$id = sotf_Utils::getParameter('id');
if ($id) {
    $db->begin();
    $smarty->assign('ID', $id);
    $prg =& $repository->getObject($id);
    if (!$prg) {
        raiseError("no_such_object", $id);
    }
    if (!$prg->getBool('published')) {
        if (!hasPerm($prg->id, 'change')) {
            raiseError("not_published_yet", $id);
            exit;
        }
        $smarty->assign("UNPUBLISHED", 1);
    }
    $page->setTitle($prg->get('title'));
    // general data
    $prgData = $prg->getAll();
    $prgData['icon'] = sotf_Blob::cacheIcon($id);
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:31,代码来源:get.php

示例5: mtime

 * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
 * @since     5.9.6
 * @version   9.8.18 
 */
/**
 * Fetch current time
 * 
 * @return double current time
 */
function mtime()
{
    $t = gettimeofday();
    return (double) ($t['sec'] . '.' . sprintf("%06d", $t['usec']));
}
// Set start time
define('STARTTIME', mtime());
ini_set('include_path', 'library/' . PATH_SEPARATOR . ini_get('include_path'));
ini_set('include_path', 'library/pear/' . PATH_SEPARATOR . ini_get('include_path'));
// Classes
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/Exception.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/DataBase.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/Notifier.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/Attach.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/AutoLink.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/BackLink.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/Controller.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/Command.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/DiffRenderer.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/FuzzyFunc.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/FuzzyLink.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'BitWiki/HtmlConverter.php';
开发者ID:kaz6120,项目名称:BitWiki,代码行数:31,代码来源:BitWiki.php

示例6: mtime

// Do the math the new way and time it
$start = mtime();
$cc = cc($nums);
$time = mtime() - $start;
echo implode($nums[0]) . " - " . implode($nums[1]) . " = " . $cc . " (cc = " . $time . ")" . "<br>";

// ===================================================================================================
*/
// ===================================================================================================
// Uncomment this block if you want to test a lot.
$cycles = 1000;
$owtime = 0;
$cctime = 0;
echo number_format($cycles) . " cycles - random numbers between 1 and 1000.<br>";
for ($i = 0; $i < $cycles; $i++) {
    $nums = randoms();
    // Do the math the old way and time it
    $start = mtime();
    $ow = ow($nums);
    $end = mtime();
    $owtime += $end - $start;
    // Do the math the new way and time it
    $start = mtime();
    $cc = cc($nums);
    $end = mtime();
    $cctime += $end - $start;
}
echo "Total time for the old way : " . abs($owtime) . " seconds<br>";
echo "Total time for the new way : " . abs($cctime) . " seconds<br>";
// ===================================================================================================
开发者ID:joetech,项目名称:common-core-vs-old-way,代码行数:30,代码来源:ccmath.php

示例7: req

}
#structure
if ($_GET['admin']) {
    req('admin');
    $out['content'] = admin();
} elseif ($_GET['msql']) {
    req('msql');
    $out['content'] = msql_adm();
} elseif (rstr(85)) {
    $out['content'] = build_deskpage($read);
} else {
    $out = build_blocks();
}
//admin
if (ses('dev')) {
    $_POST['popadm']['chrono'] = btn('small', round(mtime() - $stime, 3));
}
$madmin = popadmin();
//meta
$host = host();
$meta['favicon'] = 'favicon.ico';
if ($_GET["admin"]) {
    $meta["title"] = $_GET['admin'];
    $meta['favicon'] = uicon('screen_4to3_16', 'picol/16');
} elseif ($_GET["msql"]) {
    $meta["title"] = $_GET['msql'];
    $meta['favicon'] = uicon('database_16', 'picol/16');
} elseif ($_SESSION["read"]) {
    $meta["title"] = $_SESSION["raed"];
    $meta["descript"] = $_SESSION["descript"];
    $meta["img"] = $host . '/imgc/' . $_SESSION["imgrel"];
开发者ID:philum,项目名称:cms,代码行数:31,代码来源:sys.php

示例8: empty

?>
</td></tr>
<tr><td>User Agent</td><td><?php 
echo $_SERVER['HTTP_USER_AGENT'];
?>
</td></tr>
<tr><td>Accept Language</td><td><?php 
echo $_SERVER["HTTP_ACCEPT_LANGUAGE"];
?>
</td></tr>
<tr><td>Accept Charset</td><td><?php 
echo empty($_SERVER["HTTP_ACCEPT_CHARSET"]) ? 'Not Provided' : $_SERVER["HTTP_ACCEPT_CHARSET"];
?>
</td></tr>
<tr><td>Request Duration</td><td><?php 
echo mtime() - $time_begin;
?>
</td></tr>
</table>
</div>
<div id="msg" class="tabc">
<?php 
if (count($msg) > 0) {
    echo implode('<br />', $msg);
} else {
    echo 'No message.';
}
?>
</div>
<p>
<span style="text-align:left; float:left;"><a class="link" href="mailto:buganini@gmail.com">Contact me</a></span>
开发者ID:buganini,项目名称:amidala,代码行数:31,代码来源:amidala.php

示例9: show_json

/**
 * 打包返回AJAX请求的数据
 * @params {int} 返回状态码, 通常0表示正常
 * @params {array} 返回的数据集合
 */
function show_json($data, $code = true, $info = '')
{
    $use_time = mtime() - $GLOBALS['config']['app_startTime'];
    $result = array('code' => $code, 'use_time' => $use_time, 'data' => $data);
    if ($info != '') {
        $result['info'] = $info;
    }
    header("X-Powered-By: kodExplorer.");
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($result);
    exit;
}
开发者ID:WPG,项目名称:KODExplorer,代码行数:17,代码来源:common.function.php

示例10: die

        die('Could not SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL);
    }
    $n = mysql_num_rows($b);
    if (!$n) {
        die('No results returned in SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL);
    }
}
$t = mtime() - $tStart;
print hour() . ' SELECT (' . $n . ' rows) complete in ' . $t . ' seconds with an average of ' . $t / $nLoop . ' sec/query' . "\n";
flush();
//////////////////////////////////////
print hour() . ' Idem, maar dan met subqueries' . "\n";
flush();
$tStart = mtime();
$sSQL = 'SELECT SQL_NO_CACHE c.*, SUBSTRING_INDEX(c.id, "/", 1) AS category, SUBSTRING(c.id, LOCATE("/", c.id)+1) AS colid, (SELECT a.created_by > 0 FROM ' . TABLE_ACTIVE_COLS . ' AS a WHERE c.id = a.colid) AS active, (SELECT u.name FROM ' . TABLE_USERS . ' AS u WHERE c.created_by = u.id) AS created_by_ FROM ' . TABLE_COLS . ' AS c ORDER BY category, colid';
for ($i = 1; $i <= $nLoop; $i++) {
    $b = @mysql_query($sSQL);
    if (!$b) {
        die('Could not SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL);
    }
    $n = mysql_num_rows($b);
    if (!$n) {
        die('No results returned in SELECT data: ' . mysql_error() . "\n" . 'Query was: ' . $sSQL);
    }
}
$t = mtime() - $tStart;
print hour() . ' SELECT (' . $n . ' rows) complete in ' . $t . ' seconds with an average of ' . $t / $nLoop . ' sec/query' . "\n";
flush();
//////////////////////////////////////
exit;
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
开发者ID:LOVDnl,项目名称:LOVD3,代码行数:31,代码来源:simple_select_data.php

示例11: ks_battle

function ks_battle($group_id, $land_id, $fromadmin)
{
    global $db, $n, $userdata, $tpl, $header, $footer, $op_res_steal, $op_battle_trace;
    include LITO_MODUL_PATH . "battle/battlescript.php";
    $modul_name = "battle";
    $stime = mtime();
    $verteidiger_user_id = get_userid_from_countrie($land_id);
    $angreifer_race = get_race_id_from_group($group_id);
    $vert_race = get_race_id_from_countrie($land_id);
    $angreifer_name = $userdata['username'];
    $verteidiger_name = username($verteidiger_user_id);
    $angreifer_land = get_countrie_name_from_group_id($group_id, 1);
    $verteidiger_land = get_countrie_name_from_id($land_id, 1);
    $angreifer_user_id = get_user_id_from_group_id($group_id);
    trace_msg("angreifer group id:{$group_id} race id:{$angreifer_race}", 90);
    trace_msg("verteidiger land id:{$land_id} race id:{$vert_race}", 90);
    $kampfscript = new kampfs();
    $sql = "SELECT cc" . $n . "_groups_inhalt . * , cc" . $n . "_soldiers . * FROM cc" . $n . "_groups_inhalt INNER JOIN cc" . $n . "_soldiers ON cc" . $n . "_groups_inhalt.type = cc" . $n . "_soldiers.tabless WHERE cc" . $n . "_soldiers.race ='" . $angreifer_race . "' AND cc" . $n . "_groups_inhalt.group_id ='" . $group_id . "'";
    $result_g = $db->query($sql);
    $count_ang = 0;
    while ($row_g = $db->fetch_array($result_g)) {
        $g_id = $row_g['groups_inhalt_id'];
        $AP = $row_g['AP'];
        $VP = $row_g['VP'];
        $count_ang = $row_g['anzahl'];
        $unit_type = $row_g['type'];
        $kampfscript->setunits_angreifer($g_id, $AP * $count_ang, $VP * $count_ang, $AP, $VP, $count_ang, $unit_type);
    }
    $count_vert = 0;
    $result_sol_verteidiger = $db->query("SELECT * FROM cc" . $n . "_soldiers where race='{$vert_race}'");
    while ($row_sol_vert = $db->fetch_array($result_sol_verteidiger)) {
        $name = $row_sol_vert['tabless'];
        $id_vert = $row_sol_vert['sid'];
        $AP = $row_sol_vert['AP'];
        $VP = $row_sol_vert['VP'];
        $result_l = $db->query("SELECT {$name} FROM cc" . $n . "_countries where islandid='{$land_id}'");
        $row_l = $db->fetch_array($result_l);
        $anzahl_einheiten = $row_l[$name];
        $count_vert += $anzahl_einheiten;
        if ($anzahl_einheiten > 0) {
            $unit_type = $row_sol_vert['tabless'];
            $kampfscript->setunits_verteidiger($id_vert, $AP * $anzahl_einheiten, $VP * $anzahl_einheiten, $AP, $VP, $anzahl_einheiten, $unit_type);
        }
    }
    $all_einheiten_angr_count = 0;
    $all_einheiten_vert_count = 0;
    $verlust_angreifer = 0;
    $verlust_verteidiger = 0;
    if (intval($op_battle_trace) > 0) {
        $trace_fname = LITO_CACHE_PATH . "battle_kr/" . $land_id . "_" . time() . ".txt";
        $kampfscript->set_trace($trace_fname);
    }
    $kampfscript->calc();
    $all_einheiten_angr_count = $kampfscript->anzahl_angreifer_vor;
    $all_einheiten_vert_count = $kampfscript->anzahl_verteidiger_vor;
    $verlust_angreifer = $kampfscript->anzahl_angreifer - $kampfscript->anzahl_angreifer_end;
    $verlust_verteidiger = $kampfscript->anzahl_verteidiger - $kampfscript->anzahl_verteidiger_end;
    $all_einheiten = $kampfscript->anzahl_angreifer_vor + $kampfscript->anzahl_verteidiger_vor;
    $attack_msg = "";
    $einheit_ang = "";
    $einheiten_ang_ap = 0;
    $einheiten_ang_vp = 0;
    foreach ($kampfscript->angreifer as $name => $value) {
        $einheiten_name = $kampfscript->angreifer[$name]["unit_type"];
        $einheiten_name_org = $einheiten_name;
        $einheiten_new_count = $kampfscript->angreifer[$name]["new_units_count"];
        $einheiten_anzahl = $kampfscript->angreifer[$name]["unit_count"];
        $einheiten_name = get_soldiers_name($einheiten_name, $angreifer_race);
        $einheit_ang .= $einheiten_name . "<br>";
        $einheit_ang_count .= intval($einheiten_anzahl) . "<br>";
        $einheiten_ang_ap += $kampfscript->angreifer[$name]["ap_single"] * $einheiten_anzahl;
        $einheiten_ang_vp += $kampfscript->angreifer[$name]["vp_single"] * $einheiten_anzahl;
        if ($fromadmin == 0) {
            $db->query("update cc" . $n . "_groups_inhalt set anzahl='" . $einheiten_new_count . "' where group_id='" . $group_id . "' and type='" . $einheiten_name_org . "'");
        }
    }
    if ($fromadmin == 0) {
        $db->query("delete from cc" . $n . "_groups_inhalt where group_id='" . $group_id . "' and anzahl <='0'");
        $result_sum_group = $db->query("SELECT sum(anzahl)as all_i_groups FROM cc" . $n . "_groups_inhalt where group_id='" . $group_id . "'");
        $rowsum_group = $db->fetch_array($result_sum_group);
        $anz_goup_inhalt = $rowsum_group['all_i_groups'];
        if ($anz_goup_inhalt <= 0) {
            $db->query("delete from cc" . $n . "_groups where groupid='" . $group_id . "'");
        }
    }
    $einheiten_vert_ap = 0;
    $einheiten_vert_vp = 0;
    if ($count_vert > 0) {
        foreach ($kampfscript->verteidiger as $name => $value) {
            $einheiten_name = $kampfscript->verteidiger[$name]["unit_type"];
            $einheiten_name_org = $einheiten_name;
            $einheiten_anzahl = $kampfscript->verteidiger[$name]["unit_count"];
            $einheiten_new_count = $kampfscript->verteidiger[$name]["new_units_count"];
            $einheiten_name = get_soldiers_name($einheiten_name, $vert_race);
            $einheit_vert .= $einheiten_name . "<br>";
            $einheit_vert_count .= intval($einheiten_anzahl) . "<br>";
            $einheiten_vert_ap += $kampfscript->verteidiger[$name]["ap_single"] * $einheiten_anzahl;
            $einheiten_vert_vp += $kampfscript->verteidiger[$name]["vp_single"] * $einheiten_anzahl;
            if ($fromadmin == 0) {
                $db->query("update cc" . $n . "_countries set " . $einheiten_name_org . " ='" . $einheiten_new_count . "' where islandid='" . $land_id . "'");
//.........这里部分代码省略.........
开发者ID:Wehmeyer,项目名称:Litotex-0.7,代码行数:101,代码来源:battle_ks.php

示例12: serverDownload

 public function serverDownload()
 {
     if ($_SERVER['HTTP_REFERER'] != $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) {
         if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
             $uuid = 'download_' . $this->in['uuid'];
             if ($this->in['type'] == 'percent') {
                 //Get the download progress
                 //show_json($_SESSION[$uuid]);
                 if (isset($_SESSION[$uuid])) {
                     $info = $_SESSION[$uuid];
                     $result = array('uuid' => $this->in['uuid'], 'length' => (int) $info['length'], 'size' => (int) filesize($info['path']), 'time' => mtime());
                     show_json($result);
                 } else {
                     show_json('', false);
                 }
             } else {
                 if ($this->in['type'] == 'remove') {
                     //Cancel download; files are deleted automatically stops
                     del_file($_SESSION[$uuid]['path']);
                     unset($_SESSION[$uuid]);
                     show_json('', false);
                 }
             }
             //download
             $save_path = _DIR($this->in['save_path']);
             if (!is_writeable($save_path)) {
                 show_json($this->L['no_permission_write'], false);
             }
             $url = rawurldecode($this->in['url']);
             $header = url_header($url);
             if (!$header) {
                 show_json($this->L['download_error_exists'], false);
             }
             $save_path = $save_path . urldecode($header['name']);
             if (!checkExt($save_path)) {
                 //Allowed extension
                 $save_path = _DIR($this->in['save_path']) . date() . '.txt';
             }
             $save_path = get_filename_auto(iconv_system($save_path));
             $save_path_temp = $save_path . '.downloading';
             session_start();
             $_SESSION[$uuid] = array('length' => $header['length'], 'path' => $save_path_temp);
             session_write_close();
             if (file_download_this($url, $save_path_temp)) {
                 if (@rename($save_path_temp, $save_path)) {
                     //After downloading rename
                     $name = get_path_this(iconv_app($save_path));
                     show_json($this->L['download_success'], true, $name);
                 } else {
                     show_json($this->L['download_error_create'], false);
                 }
             } else {
                 show_json($this->L['download_error_create'], false);
             }
         }
     } else {
         header('Location: 403.php');
     }
 }
开发者ID:ajhalls,项目名称:KODExplorer,代码行数:59,代码来源:explorer.class.php

示例13: render

 /**
  * ページを表示する。
  *
  * @param	array(string => string)	$value	スキンに渡す値。bodyとtitleは必須。
  */
 function render($value)
 {
     $command = array();
     foreach (Command::getCommands() as $c) {
         $html = $c->getbody();
         if ($html != '') {
             $command[substr(get_class($c), 8)] = $html;
         }
     }
     $plugin = array();
     foreach (Plugin::getPlugins() as $c) {
         $html = $c->getbody();
         if ($html != '') {
             $plugin[substr(get_class($c), 7)] = $html;
         }
     }
     $this->smarty->assign('command', $command);
     $this->smarty->assign('plugin', $plugin);
     $this->smarty->assign('option', $this->option);
     $this->smarty->assign('headeroption', $this->headeroption);
     $this->smarty->assign('theme', $this->theme);
     $this->smarty->assign($value);
     header('Content-Type: text/html; charset=UTF-8');
     $this->smarty->assign('runningtime', sprintf('%.3f', mtime() - STARTTIME));
     $this->smarty->display(SKINFILE);
 }
开发者ID:riaf,项目名称:kinowiki,代码行数:31,代码来源:renderer.inc.php

示例14: chrono

function chrono($d = '')
{
    static $t;
    static $start;
    static $cum;
    $top = round((mtime() - $start) * 1000, 3);
    $start = mtime();
    if ($d != $t) {
        $ret = $d . ': ' . $top . 'ms';
        $t = $d;
        $cum = 0;
    } elseif ($t && $t == $d) {
        $cum += $top;
        $ret .= 'start: ' . $cum . 'ms';
    }
    if ($d) {
        return btn('txtsmall2', $ret) . ' ';
    }
}
开发者ID:philum,项目名称:cms,代码行数:19,代码来源:lib.php

示例15: json_decode

# {"params": [], "method": "getwork", "id": "json"}
try {
    $oo = json_decode($request_body);
    if ($oo->{'method'} == "getwork") {
        $param = null;
        $bitcoin = new jsonRPCClient('http://' . $username . ':' . $password . '@' . $url . ':' . $port . '/');
        # ugly stuff, but count() returns always 0 :(
        foreach ($oo->{'params'} as $i => $value) {
            $param = $value;
            break;
        }
        if ($param == null) {
            # example
            # $w = '{ "midstate":"eae773ad01907880889ac5629af0c35438376e8c4ae77906301c65fa89c2779c","data":"0000000109a78d37203813d08b45854d51470fcdb588d6dfabbe946e92ad207e0000000038a8ae02f7471575aa120d0c85a10c886a1398ad821fadf5124c37200cb677854e0603871d07fff800000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"0000000000000000000000000000000000000000000000000000f8ff07000000" }';
            # real
            if ($cache == 1 && mtime($filename) + $workCacheTime > time()) {
                $of = json_decode(read($filename));
            } else {
                $of = $bitcoin->getwork();
                if ($cache == 1) {
                    $write = 1;
                }
            }
            header('HTTP/1.1 200 OK');
            header('Content-Type: application/json');
            # patch request id into response
            $ret = json_decode('{}');
            $ret->{'id'} = $oo->{'id'};
            $ret->{'result'} = $of;
            $ret->{'error'} = null;
            echo json_encode($ret);
开发者ID:4m1g0,项目名称:hamiyoca,代码行数:31,代码来源:index.php


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