Exemplo n.º 1
0
 public function indexAction()
 {
     $reader = new \Zend\Config\Reader\Ini();
     $reader->setNestSeparator('.');
     /** default: '.' */
     $configArray = $reader->fromFile(__DIR__ . '/config/ini/module.config.ini');
     $configArray['view_manager']['template_path_stack'][] = __DIR__ . '/../view';
     return $configArray;
 }
Exemplo n.º 2
0
 public function index2Action()
 {
     $reader = new \Zend\Config\Reader\Ini();
     // Cau hinh
     $reader->setNestSeparator('-');
     $data = $reader->fromFile(__DIR__ . '/../../../config/ini/module.config.ini', true);
     $config = new \Zend\Config\Config(array(), true);
     $config->production = array();
     $config->production->website = 'www.zend.vn';
     $config->production->account = array();
     $config->production->account->email = '*****@*****.**';
     $config->production->account->port = 465;
     $writer = new \Zend\Config\Writer\Ini();
     $writer->setNestSeparator('-');
     $writer->toFile(__DIR__ . '/../../../config/ini/config.ini', $config);
     //return false;
 }
Exemplo n.º 3
0
 public function index2Action()
 {
     echo __FILE__ . __METHOD__ . '<br/>';
     $reader = new \Zend\Config\Reader\Ini();
     $reader->setNestSeparator('.');
     /** default: '.' */
     $data = $reader->fromFile(__DIR__ . '/../../../config/ini/module.config.ini');
     echo '<pre class="container">';
     print_r($data);
     echo '</pre>';
     /** Viết xuống file cấu hình */
     //        $config = new \Zend\Config\Config(array(), true);
     //        $config->production                     = array();
     //        $config->production->website            = '*****@*****.**';
     //        $config->production->account            = array();
     //        $config->production->account->email     = '*****@*****.**';
     //        $config->production->account->password  = '******';
     //
     //        $writer = new \Zend\Config\Writer\Ini();
     //        $writer->setNestSeparator('-');
     //        $writer->toFile(__DIR__.'/../../../config/ini/config.ini', $config);
     return false;
 }
Exemplo n.º 4
0
<?php

$ini = new Zend\Config\Reader\Ini();
$iniConfiguration = $ini->setNestSeparator('::')->fromFile(__DIR__ . '/' . 'm.ini');
return $iniConfiguration;
$sImporterPath = dirname(__FILE__);
chdir($sImporterPath);
$sScriptPath = substr($sImporterPath, 0, strrpos($sImporterPath, DIRECTORY_SEPARATOR));
$sIncludePath = $sImporterPath . PATH_SEPARATOR . $sScriptPath . PATH_SEPARATOR;
set_include_path(get_include_path() . PATH_SEPARATOR . $sIncludePath);
require 'Zend/Loader/StandardAutoloader.php';
$autoloader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$sImporterClassNameSpacePath = $sImporterPath . DIRECTORY_SEPARATOR . 'Classes';
$sInstallerNameSpacePath = $sScriptPath . DIRECTORY_SEPARATOR . 'installer' . DIRECTORY_SEPARATOR . 'Reports' . DIRECTORY_SEPARATOR;
$autoloader->registerNamespace('Classes', $sImporterClassNameSpacePath, $sInstallerNameSpacePath);
$autoloader->register();
/*****************************************
 * LOAD CONFIGURATION
 *****************************************/
$oConfig = new Zend\Config\Reader\Ini();
$oConfig->setNestSeparator(' : ');
$aConfig = $oConfig->fromFile('config.ini.php');
// First attempt to load relevant section based on host name
if (isset($_SERVER['HTTP_HOST'])) {
    $sServerHost = $_SERVER['HTTP_HOST'];
    foreach ($aConfig as $sSection => $aConfigSection) {
        if (isset($aConfigSection['common']) and isset($aConfigSection['common']['host'])) {
            $sHost = $aConfigSection['common']['host'];
            if ($sHost != '' and $sHost === $sServerHost) {
                $sConfigSection = $sSection;
                break;
            }
        }
    }
}
// Override this with 'active.environment' is it has been set.