本文整理汇总了PHP中Nette\Environment::loadConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::loadConfig方法的具体用法?PHP Environment::loadConfig怎么用?PHP Environment::loadConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Environment
的用法示例。
在下文中一共展示了Environment::loadConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: proxy
* cURL Test bootstrap file.
*
* @copyright Copyright (c) 2009 Filip Procházka
* @package Vdsc
*/
require_once dirname(__FILE__) . '/Nette/loader.php';
require_once dirname(__FILE__) . '/Curl/Request.php';
use Curl\Request;
use Curl\CurlException;
use Nette\Environment;
use Nette\Debug;
// register wrapper safe for file manipulation
Nette\SafeStream::register();
Debug::enable();
Debug::$strictMode = True;
Environment::loadConfig(realpath('./config.ini'));
$config = Environment::getConfig('curl');
$config['downloadFolder'] = realpath("download");
$config['cookieFile'] = $config['downloadFolder'] . '/cookies.tmp';
function proxy(&$test)
{
// $test->addProxy('192.168.1.160', 3128);
}
if (TRUE) {
// test 1: get
$test = new Request("http://curl.kdyby.org/prevodnik.asm.zdrojak", $config);
// $test = new Curl("http://iskladka.cz/iCopy/downloadBalancer.php?file=1222561395_obava_bojov+cz.avi&ticket=pc1660-1265493063.25");
echo "<hr>test 1: get ... init ok<hr>", "<h2>Setup:</h2>";
proxy($test);
// for debbuging at school
dump($test);
示例2: die
* @copyright Copyright (c) 2010 John Doe
* @package MyApplication
*/
use Nette\Debug;
use Nette\Environment;
use Nette\Application\Route;
use Nette\Application\SimpleRouter;
// REMOVE THIS LINE
if (!is_file(LIBS_DIR . '/Nette/loader.php')) {
die('Copy Nette Framework to /libs/ directory.');
}
// Step 1: Load Nette Framework
// this allows load Nette Framework classes automatically so that
// you don't have to litter your code with 'require' statements
require LIBS_DIR . '/Nette/loader.php';
// Step 2: Configure environment
// 2a) enable Nette\Debug for better exception and error visualisation
Debug::enable();
// 2b) load configuration from config.ini file
Environment::loadConfig();
// Step 3: Configure application
// 3a) get and setup a front controller
$application = Environment::getApplication();
$application->errorPresenter = 'Error';
//$application->catchExceptions = TRUE;
// Step 4: Setup application router
$router = $application->getRouter();
$router[] = new Route('index.php', array('presenter' => 'Homepage', 'action' => 'default'), Route::ONE_WAY);
$router[] = new Route('<presenter>/<action>/<id>', array('presenter' => 'Homepage', 'action' => 'default', 'id' => NULL));
// Step 5: Run the application!
$application->run();
示例3: function
Nette\Application\Routers\RouteList,
Nette\Application\Routers\SimpleRouter;
// Load Nette Framework
// this allows load Nette Framework classes automatically so that
// you don't have to litter your code with 'require' statements
require __DIR__ . '/../../../Nette/loader.php';
// Enable Nette\Debug for error visualisation & logging
Debugger::enable();
// Load configuration from config.neon file
Environment::loadConfig(__DIR__ . '/config.neon');
// Configure application
$application = Environment::getApplication();
// Setup router
$application->onStartup[] = function() use ($application) {
$router = $application->getRouter();
// mod_rewrite detection
if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) {
$router[] = new Route('index.php', 'Front:Default:default', Route::ONE_WAY);
$router[] = $adminRouter = new RouteList('Admin');