本文整理汇总了PHP中App::app方法的典型用法代码示例。如果您正苦于以下问题:PHP App::app方法的具体用法?PHP App::app怎么用?PHP App::app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App::app方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: a
static function a()
{
if (isset(self::$app)) {
return self::$app;
}
return self::$app = new Container();
}
示例2: Create
public static function Create($config)
{
if (!self::$app) {
self::$app = new Org_Apache_Oodt_Balance_Core_Application($config);
}
return self::$app;
}
示例3: _checkLevel
/**
* 如果框架debug为true,返回true
* 如果框架debug为false,根据日志配置的debug返回
* if li global config debug is false,
* @return boolean if write return true, otherwise false
*/
private function _checkLevel($level)
{
// 框架debug开启
if (isset(App::app()->config['debug']) && App::app()->config['debug'] === true) {
return true;
}
//单日志
if ($this->_config['multi'] == false) {
if (isset($this->_config['debug']) && $this->_config['debug'] === true) {
return true;
} else {
if ($level == 'debug') {
return false;
} else {
return true;
}
}
} else {
if (isset($this->_config['config'][$this->_configIndex]['debug']) && $this->_config['config'][$this->_configIndex]['debug'] === true) {
return true;
} else {
if ($level == 'debug') {
return false;
} else {
return true;
}
}
}
}
示例4: onTick
/**
* onTick is called once every loop and is responsible for dispatching the
* message to the clients as they are received.
*/
public function onTick()
{
$log = App::app()->chatGetLog($this->lptr);
foreach ($log as $msg) {
$this->write("{$msg}\n");
}
}
示例5: init
public function init()
{
if (isset(App::app()->config['route']['urlFormat'])) {
$this->_urlFormat = App::app()->config['route']['urlFormat'];
}
$this->_pathInfo = $this->parseUrl();
return $this->_pathInfo;
}
示例6: init
public static function init()
{
if (isset(App::app()->config['session'])) {
if (isset(App::app()->config['session']['driver']) && (App::app()->config['session']['driver'] = 'mysql')) {
$driver = 'Session' . ucfirst(App::app()->config['session']['driver']);
$handler = new SessionMysql(App::app()->config['session']['config']);
session_set_save_handler($handler, true);
}
}
session_start();
}
示例7: __get
function __get($dbName)
{
if (isset(App::app()->config['database'][$dbName])) {
$driver = 'Li\\' . ucfirst(App::app()->config['database'][$dbName]['driver']);
if (!(isset($this->{$dbName}) && $this->{$dbName} instanceof $driver)) {
$this->{$dbName} = new $driver(App::app()->config['database'][$dbName]);
}
return $this->{$dbName};
} else {
throw new Exception("config no db " . $dbName);
}
}
示例8: applySdlTag
public function applySdlTag(\Cherry\Data\Ddl\SdlTag $node)
{
if ($node->getName() == 'table') {
if ($node->getValue() != $this->name) {
\App::app()->warn("Not applying SDL node to table as names differ: " . $node->getValue());
return false;
}
$cur = $this->getSdlTag();
foreach ($node->getChildren('column') as $col) {
$curcol = $cur->getChild('column', $col->getValue());
// Check if the node
if ($curcol == null || $curcol != $col) {
echo "Column " . $col->getName() . " needs creating/applying!\n";
}
}
}
}
示例9: __get
function __get($cacheName)
{
if (isset(App::app()->config['redis'][$cacheName])) {
if (!(isset($this->{$cacheName}) && $this->{$cacheName} instanceof \Redis)) {
$this->{$cacheName} = new \Redis();
if (isset(App::app()->config['redis'][$cacheName]['pconnect']) && App::app()->config['redis'][$cacheName]['pconnect'] === true) {
$ret = $this->{$cacheName}->pconnect(App::app()->config['redis'][$cacheName]['ip'], App::app()->config['redis'][$cacheName]['port']);
} else {
$ret = $this->{$cacheName}->connect(App::app()->config['redis'][$cacheName]['ip'], App::app()->config['redis'][$cacheName]['port']);
}
if ($ret === false) {
throw new Exception("Redis " . App::app()->config['redis'][$cacheName]['ip'] . ':' . App::app()->config['redis'][$cacheName]['port'] . ' can not connect');
}
}
return $this->{$cacheName};
} else {
throw new Exception("config no redis " . $dbName);
}
}
示例10: generate
public function generate($key = null)
{
if (isset(App::app()->config['captcha']) && is_array(App::app()->config['captcha'])) {
$this->_config = array_merge($this->_config, App::app()->config['captcha']);
}
$this->_create();
$text = $this->_getText($key);
// 随机字体
$font = $this->_config['fonts'][array_rand($this->_config['fonts'])];
$this->_text($text, $font);
if ($this->_config['type'] !== 'math') {
// 随机干扰
if ($this->_config['lineNumber'] > 0) {
$i = 0;
for (; $i < $this->_config['lineNumber']; $i++) {
$this->_line();
}
}
}
header("Content-type: image/png");
imagepng($this->_im);
imagedestroy($this->_im);
}
示例11: redirect
public function redirect($uri, $params = [])
{
foreach ($params as $key => $value) {
$urlParam[] = $key;
$urlParam[] = $value;
}
$url = $uri . '/' . implode('/', $urlParam);
redirect(App::app()->config['domain'] . url() . '/' . $url);
// debug(implode('/', $params));
// debug(\http_build_query($argv[0], '','/'));
// debug(func_get_args());
// debug(url().$uri);
// redirect(url().$uri);
}
示例12:
<?php
require_once './src/App.class.php';
$app = App::app();
$app->run();
示例13: register
public function register($required)
{
foreach ($required as $name) {
$_POST[$name] = pg_escape_string($_POST[$name]);
}
$same_login = $this->make_query("SELECT * FROM Konto WHERE login = '" . $_POST['login'] . "';");
if ($same_login != null) {
App::app()->add_info('Już jest użytkownik z takim loginem', 'danger');
App::app()->register_error();
}
$this->make_query("INSERT INTO Konto (id, login, password, nazwa, typ) VALUES (default, '" . $_POST['login'] . "', '" . $_POST['password'] . "', '" . $_POST['name'] . "', '" . $_POST['type'] . "');");
if ($this->login()) {
$_SESSION['success'] = 'Rejestracja się powiodła!';
App::app()->refresh_home();
} else {
App::app()->add_info("Rejestracja się nie powiodła", 'danger');
App::app()->register_error();
}
}
示例14: exception_handler
public static function exception_handler($exception)
{
if (App::app()->config['debug']) {
echo "Exception: " . $exception->getMessage() . ' in ' . $exception->getFile() . ' on ' . $exception->getLine() . "<br />";
echo 'trace :' . '<br />';
$trace = $exception->getTrace();
foreach ($trace as $v) {
echo '<b>' . $v['file'] . '</b> in <b>' . $v['function'] . '</b> on <b>' . $v['line'] . "</b><br />";
}
} else {
Log::log()->error("Exception: " . $exception->getMessage() . ' in ' . $exception->getFile() . ' on ' . $exception->getLine());
}
}
示例15: make_notifications
public function make_notifications()
{
$types = array('success', 'info', 'danger', 'warning');
foreach ($types as $type) {
if (isset($_SESSION[$type])) {
App::app()->add_info($_SESSION[$type], $type);
unset($_SESSION[$type]);
}
}
}