当前位置: 首页>>代码示例>>PHP>>正文


PHP Environment::getVariables方法代码示例

本文整理汇总了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());
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:5,代码来源:SettingsPresenter.php

示例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";
}
开发者ID:vrana,项目名称:nette,代码行数:31,代码来源:test.variable.php

示例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();
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:33,代码来源:AdminPagesPresenter.php


注:本文中的Environment::getVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。