本文整理汇总了PHP中Environment::getVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::getVariables方法的具体用法?PHP Environment::getVariables怎么用?PHP Environment::getVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::getVariables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDefault
public function renderDefault()
{
$this->template->form = $this->getComponent('settingsForm');
$this->template->form->setDefaults(Environment::getVariables());
}
示例2: catch
/*use Nette\Environment;*/
echo "Getting variable 'foo':\n";
Debug::dump(Environment::getVariable('foo'));
try {
echo "Getting variable 'tempDir':\n";
Debug::dump(Environment::getVariable('tempDir'));
} catch (Exception $e) {
echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
echo "Defining constant 'APP_DIR':\n";
define('APP_DIR', '/myApp');
echo "Getting variable 'appDir':\n";
Debug::dump(Environment::getVariable('appDir'));
echo "Getting variable 'tempDir' #2:\n";
Debug::dump(Environment::getVariable('tempDir'));
echo "Setting variable 'test'...\n";
Environment::setVariable('test', '%appDir%/test');
echo "Getting variable 'test':\n";
Debug::dump(Environment::getVariable('test'));
echo "Getting variables:\n";
Debug::dump(Environment::getVariables());
try {
echo "Setting circular variables...\n";
Environment::setVariable('bar', '%foo%');
Environment::setVariable('foo', '%foobar%');
Environment::setVariable('foobar', '%bar%');
echo "Getting circular variable:\n";
Debug::dump(Environment::getVariable('bar'));
} catch (Exception $e) {
echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
示例3: handleBrowseFiles
public function handleBrowseFiles($dir, $ext)
{
$cache = Environment::getCache($this->getName());
$ckey = __FUNCTION__ . $dir . $ext;
fd(Environment::getVariables());
if (!isset($cache[$ckey])) {
$root = WWW_DIR . '/';
$response = '';
if (file_exists($root . $dir)) {
$files = scandir($root . $dir);
natcasesort($files);
if (count($files) > 2) {
$response .= "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
foreach ($files as $file) {
if (file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file)) {
$response .= "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($dir . $file) . "/\">" . htmlentities($file) . "</a></li>";
}
}
foreach ($files as $file) {
$file_info = pathinfo($file);
if (file_exists($root . $dir . $file) && $file != '.' && $file != '..' && !is_dir($root . $dir . $file) && $file_info['extension'] == $ext) {
$ext = preg_replace('/^.*\\./', '', $file);
$response .= "<li class=\"file ext_{$ext}\"><a href=\"#\" rel=\"" . htmlentities($dir . $file) . "\">" . htmlentities($file) . "</a></li>";
}
}
$response .= "</ul>";
}
}
$cache->save($ckey, $response, array('expire' => time() + 60 * 10));
}
echo $cache[$ckey];
$this->terminate();
}