本文整理汇总了PHP中Environment::isConsole方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::isConsole方法的具体用法?PHP Environment::isConsole怎么用?PHP Environment::isConsole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::isConsole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startup
protected function startup()
{
if (!Environment::isConsole()) {
throw new InvalidStateException('Access allowed only from console!');
}
parent::startup();
}
示例2: array
// Step 3: Configure application
// 3a) get and setup a front controller
$application = Environment::getApplication();
$application->errorPresenter = 'Front:Error';
if (Environment::isProduction() && Debug::$productionMode) {
$application->catchExceptions = true;
} else {
$application->catchExceptions = false;
}
dibi::connect(Environment::getConfig("database"));
// Step 4: Setup application router
$routes = array();
/* MENU ITEMS */
$routes[] = new Route('<lang [a-z]{2}>/<id>/', array('module' => 'Front', 'presenter' => 'Page', 'action' => 'default', 'id' => array(Route::FILTER_IN => callback('MenuSeoModel::findIdByUri'), Route::FILTER_OUT => callback('MenuSeoModel::findUriById')), 'lang' => NULL));
// setup CLI mode
if (Environment::isConsole()) {
Debug::$productionMode = false;
// to allow 'dump' render output
$application->allowedMethods = false;
$routes[] = new CliRouter(array('action' => 'Console:Default:default'));
}
$application->addRoutes($routes);
FormMacros::register();
/***** ***** **
* Debug Bar *
****** ***** **/
$todoPanel = new TodoPanel();
$todoPanel->todoMask = array('TODO', 'FIXME', 'FIX ME', 'FIX', 'TO DO', 'PENDING', 'XXX');
Debug::addPanel($todoPanel);
//PresenterTreePanel::register();
CallbackPanel::register();
示例3:
<h1>Nette\Environment mode test</h1>
<pre>
<?php
require_once '../../Nette/loader.php';
/*use Nette\Debug;*/
/*use Nette\Environment;*/
echo "Is console?\n";
Debug::dump(Environment::isConsole());
echo "Is production mode?\n";
Debug::dump(Environment::isProduction());
define('DEBUG_MODE', FALSE);
echo "Is debugging?\n";
Debug::dump(Environment::isDebugging());
echo "Setting mode...\n";
Environment::setMode('debug', 123);
echo "Is debugging?\n";
Debug::dump(Environment::isDebugging());