本文整理汇总了PHP中Q::autoload方法的典型用法代码示例。如果您正苦于以下问题:PHP Q::autoload方法的具体用法?PHP Q::autoload怎么用?PHP Q::autoload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q
的用法示例。
在下文中一共展示了Q::autoload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Users_after_Q_session_write
function Users_after_Q_session_write($params)
{
Q::$state['session'] = true;
if (!$params['changed']) {
return;
}
// Q::autoload('Db');
// Q::autoload('Db_Mysql');
// Q::autoload('Db_Result');
// Q::autoload('Db_Expression');
// Q::autoload('Db_Query');
// Q::autoload('Db_Query_Mysql');
// Q::autoload('Db_Row');
// Q::autoload('Base_Users_Session');
// Q::autoload('Base_Users');
// Q::autoload('Users');
Q::autoload('Q_Utils');
Q::autoload('Q_Config');
Q::autoload('Q_Session');
$id = Q_Session::id();
if (!$id) {
return;
}
$parts = explode('-', $id);
$duration = count($parts) > 1 ? $parts[0] : 0;
$content = Q::json_encode($_SESSION, JSON_FORCE_OBJECT);
if (Users::$loggedOut) {
Q_Utils::sendToNode(array("Q/method" => "Users/session", "sessionId" => $id, "content" => null, "duration" => $duration));
} else {
if (Q_Session::id() and !empty($_SERVER['HTTP_HOST'])) {
try {
Q_Utils::sendToNode(array("Q/method" => "Users/session", "sessionId" => $id, "content" => $content, "duration" => $duration));
} catch (Exception $e) {
// don't throw here, it would only result in a mysterious fatal error
}
}
}
}
示例2: Users_after_Q_session_destroy
function Users_after_Q_session_destroy($params)
{
Q::$state['session'] = true;
// Q::autoload('Db');
// Q::autoload('Db_Mysql');
// Q::autoload('Db_Result');
// Q::autoload('Db_Expression');
// Q::autoload('Db_Query');
// Q::autoload('Db_Query_Mysql');
// Q::autoload('Db_Row');
// Q::autoload('Base_Users_Session');
// Q::autoload('Base_Users');
// Q::autoload('Users');
Q::autoload('Q_Utils');
Q::autoload('Q_Config');
Q::autoload('Q_Session');
$id = Q_Session::id();
if (!$id) {
return;
}
$content = Q::json_encode($_SESSION, JSON_FORCE_OBJECT);
Q_Utils::sendToNode(array("Q/method" => "Users/session", "sessionId" => $id, "content" => null, "updatedTime" => null, "destroyed" => true));
}
示例3: coloredString
/**
* Return colored text that you can output in logs or text mode
* Pass an exception or
* @param {string|Exception} $exception The exception or an exception message. If the later, you must pass three more arguments.
* @param {string} [$file]
* @param {string} [$line]
* @param {string} [$trace]
* @return {string}
*/
static function coloredString($message, $file = null, $line = null, $trace = null)
{
if ($message instanceof Exception) {
$e = $message;
$traceString = is_callable(array($e, 'getTraceAsStringEx')) ? $e->getTraceAsStringEx() : $e->getTraceAsString();
return self::coloredString($e->getMessage(), $e->getFile(), $e->getLine(), $traceString);
}
$colors = Q_Config::get('Q', 'exception', 'colors', array());
Q::autoload('Q_Utils');
$fields = array('message' => $message, 'fileAndLine' => "in {$file} ({$line})", 'trace' => $trace);
foreach ($fields as $f => $v) {
$c0 = isset($colors[$f][0]) ? $colors[$f][0] : null;
$c1 = isset($colors[$f][1]) ? $colors[$f][1] : null;
$fields[$f] = Q_Utils::colored($v, $c0, $c1);
}
$reset = Q_Utils::colored("", "", "");
return "{$fields['message']}\n\n{$fields['fileAndLine']}\n{$fields['trace']}\n";
}