本文整理汇总了PHP中Timer::now方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::now方法的具体用法?PHP Timer::now怎么用?PHP Timer::now使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::now方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_replace
#$phpversion = str_replace(".","",phpversion())*1;
Timer::now("init", __FILE__, __LINE__);
$pars = explode("','", $par);
$pars[0] = substr($pars[0], 1);
$pars[count($pars) - 1] = substr($pars[count($pars) - 1], 0, strlen($pars[count($pars) - 1]) - 1);
if (!method_exists($d, $met)) {
if (!method_exists($d, "__call")) {
Red::errorD("Die Methode {$c}::{$met} existiert nicht");
} else {
array_unshift($pars, $met);
$met = "__call";
}
}
ob_start();
$method = new ReflectionMethod($c, $met);
try {
$method->invokeArgs($d, $pars);
} catch (FieldDoesNotExistException $e) {
ob_end_flush();
Red::errorUpdate($e);
}
Timer::now("done", __FILE__, __LINE__);
$timers = Timer::getLogged();
if (count($timers) > 0) {
header("X-Timers: " . json_encode($timers));
}
if (isset($_SESSION["phynx_Achievements"]) and is_array($_SESSION["phynx_Achievements"]) and count($_SESSION["phynx_Achievements"]) > 0) {
header("X-Achievements: " . json_encode($_SESSION["phynx_Achievements"]));
$_SESSION["phynx_Achievements"] = array();
}
ob_end_flush();
示例2: makeNewLine2
function makeNewLine2($table, $A)
{
$fields = PMReflector::getAttributesArray($A);
#if(PHYNX_MYSQL_STRICT)
# $this->fixTypes($table, $A);
$values = "NULL";
if (self::$useAsNextID != null) {
$values = self::$useAsNextID;
self::$useAsNextID = null;
}
$sets = "`" . $table . "ID`";
for ($i = 0; $i < count($fields); $i++) {
if ($fields[$i] == $table . "ID") {
continue;
}
#if(is_numeric($A->$fields[$i])) $values .= ", ".$A->$fields[$i]."\n";
#else
$cf = $fields[$i];
$values .= ", '" . $this->cWrite->real_escape_string($A->{$cf}) . "'\n";
$sets .= ",\n`" . $cf . "`";
}
$sql = "INSERT INTO\n {$table}\n ({$sets}) VALUES ({$values})";
$_SESSION["messages"]->addMessage("executing MySQL: {$sql}");
Timer::now("sql start", __FILE__, __LINE__);
$this->cWrite->query($sql);
Timer::now("sql end", __FILE__, __LINE__);
DBStorage::$queryCounter++;
if ($this->cWrite->error and $this->cWrite->errno == 1054) {
preg_match("/[a-zA-Z0-9 ]*\\'([a-zA-Z0-9\\.]*)\\'[a-zA-Z ]*\\'([a-zA-Z ]*)\\'.*/", $this->cWrite->error, $regs);
throw new FieldDoesNotExistException($regs[1], $regs[2]);
}
if ($this->cWrite->error and $this->cWrite->errno == 1062) {
throw new DuplicateEntryException($this->cWrite->error);
}
if ($this->cWrite->error) {
throw new StorageException($this->cWrite->error);
}
if ($this->cWrite->error and PHYNX_USE_SYSLOG) {
syslog(LOG_ERR, "MySQL: " . $this->cWrite->error . "(" . $this->cWrite->errno . ") in {$sql}");
}
return $this->cWrite->insert_id;
}
示例3: loadMultipleV4
function loadMultipleV4(SelectStatement $statement, $typsicher = false)
{
#file_put_contents(Util::getRootPath()."debug.txt", print_r(debug_backtrace(), true));
$where = "(";
$lastKey = "";
$closeBrackets = "";
foreach ($statement->whereFields as $key => $value) {
$addOpenBracket = false;
if ($where != "(" and $statement->whereBracketGroup[$lastKey] != $statement->whereBracketGroup[$key]) {
$addOpenBracket = true;
$where .= ")";
}
$currentWhereValue = $statement->whereValues[$key];
if ($currentWhereValue != "NULL" and $currentWhereValue != "NOT NULL" and substr($currentWhereValue, 0, 3) != "t1." and substr($currentWhereValue, 0, 3) != "t2.") {
$currentWhereValue = "" . $this->c->quote($currentWhereValue) . "";
}
$where .= ($where != "(" ? " " . $statement->whereLogOp[$key] . " " . ($addOpenBracket ? "(" : "") : "") . "" . $statement->whereFields[$key] . " " . $statement->whereOperators[$key] . " " . $currentWhereValue . "";
$lastKey = $key;
}
$where .= ")";
$order = "";
foreach ($statement->order as $key => $value) {
$order .= ($order != "" ? ", " : "") . $statement->order[$key] . " " . $statement->orderAscDesc[$key];
}
$tables = array();
for ($i = 0; $i < count($statement->joinTables); $i++) {
if (!isset($tables[$statement->joinTables[$i]])) {
$tables[$statement->joinTables[$i]] = array();
}
$tables[$statement->joinTables[$i]][] = array($statement->joinConditions[$i][0], $statement->joinConditionOperators[$i], $statement->joinConditions[$i][1], $statement->joinTypes[$i]);
}
$t = 2;
$joinAdd = "";
foreach ($tables as $table => $conditions) {
$type = "LEFT";
$ons = "";
for ($i = 0; $i < count($conditions); $i++) {
if ($i == 0) {
$ons .= ((!strpos($conditions[$i][0], ".") and $conditions[$i][0][0] != " ") ? "t1." : "") . "" . $conditions[$i][0] . " " . $conditions[$i][1] . " t{$t}." . $conditions[$i][2];
} else {
if ($conditions[$i][2] != "NOT NULL" and $conditions[$i][2] != "NULL") {
$conditions[$i][2] = "'" . $conditions[$i][2] . "'";
}
$ons .= " AND t{$t}." . $conditions[$i][0] . " " . $conditions[$i][1] . " " . $conditions[$i][2] . "";
}
if (isset($conditions[$i][3]) and $conditions[$i][3] != "") {
$type = $conditions[$i][3];
}
}
$joinAdd .= "\n {$type} JOIN " . $table . " t{$t} ON({$ons})";
$t++;
}
if ($this->affectedRowsOnly and count($statement->group) === 0) {
$tempFields = $statement->fields;
$statement->fields = array("COUNT(*) AS \"anzahlTotal\"");
$order = "";
}
if (count($statement->limit) > 0 and strpos($statement->limit[0], ",") > 0) {
$statement->limit = explode(",", $statement->limit[0]);
}
foreach ($statement->fields as $k => $field) {
if ($field == "t1." . $statement->table[0] . "ID") {
$statement->fields[$k] = "t1." . $statement->table[0] . "ID AS \"" . $statement->table[0] . "ID\"";
if (count($statement->group) > 0) {
$statement->fields[$k] = "MAX(t1." . $statement->table[0] . "ID) AS \"" . $statement->table[0] . "ID\"";
}
break;
}
}
$sql = "SELECT\n " . implode(",\n ", $statement->fields) . "\n FROM " . $statement->table[0] . " t1{$joinAdd} " . ($where != "()" ? "\n WHERE {$where}" : "") . (count($statement->group) > 0 ? "\n GROUP BY " . implode(", ", $statement->group) : "") . ($order != "" ? "\n ORDER BY {$order}" : "") . (count($statement->limit) == 1 ? "\n LIMIT " . $statement->limit[0] : "") . (count($statement->limit) > 1 ? "\n LIMIT " . $statement->limit[1] . " OFFSET " . $statement->limit[0] : "");
#echo $sql;
$collector = array();
if ($statement->table[0] != "Userdata") {
$_SESSION["messages"]->startMessage("executing PDO: {$sql}");
}
#echo nl2br($sql)."<br /><br />";
#$q = $this->c->query($sql);
$q = $this->c->prepare($sql);
#echo $sql;
#echo "\n";
#var_dump($q);
Timer::now("sql start", __FILE__, __LINE__);
$q->execute();
Timer::now("sql end", __FILE__, __LINE__);
#print_r($this->c->errorInfo());
DBPDOStorage::$queryCounter++;
#if($this->c->error AND ($this->c->errno == 1045 OR $this->c->errno == 2002)) throw new NoDBUserDataException();
#if($this->c->error AND $this->c->errno == 1146) throw new TableDoesNotExistException($statement->table[0]);
#if($this->c->error AND $this->c->errno == 1046) throw new DatabaseNotSelectedException();
#if($this->c->error AND $this->c->errno == 1054) {
# preg_match("/[a-zA-Z0-9 ]*\'([a-zA-Z0-9\.]*)\'[a-zA-Z ]*\'([a-zA-Z ]*)\'.*/", $this->c->error, $regs);
# throw new FieldDoesNotExistException($regs[1],$regs[2]);
#}
#if($this->c->error) echo "MySQL-Fehler: ".$this->c->error."<br />Fehlernummer: ".$this->c->errno;
#echo $sql."<br /><br />";
#if($statement->table[0] != "Userdata") $_SESSION["messages"]->endMessage(": ".$this->c->affected_rows." ".$statement->table[0]." geladen");
if ($this->affectedRowsOnly) {
$this->affectedRowsOnly = false;
if (count($statement->group) === 0) {
$statement->fields = $tempFields;
//.........这里部分代码省略.........