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


PHP G::iniGet方法代码示例

本文整理汇总了PHP中G::iniGet方法的典型用法代码示例。如果您正苦于以下问题:PHP G::iniGet方法的具体用法?PHP G::iniGet怎么用?PHP G::iniGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在G的用法示例。


在下文中一共展示了G::iniGet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($config, $env = null)
 {
     $app = self::app();
     if (!is_null($app)) {
         throw new Exception\StartupError('Only one application can be initialized');
     }
     $this->_environ = $env;
     $config = $this->_loadConfig($config);
     if ($config == null || !$config instanceof Config_Abstract || $this->parseOptions($config->toArray()) != true) {
         throw new Exception\StartupError('Initialization of application config failed');
     }
     //$this->parseOptions($config->toArray());
     $this->_config = $config;
     //request initialization
     $request = new Request\Http();
     if ($request == null) {
         throw new Exception\StartupError('Initialization of request failed');
     }
     //dispatcher
     $this->_dispatcher = Dispatcher::getInstance();
     if ($this->_dispatcher == null || !$this->_dispatcher instanceof Dispatcher) {
         throw new Exception\StartupError('Instantiation of dispatcher failed');
     }
     $this->_dispatcher->setRequest($request);
     //loader initialization
     $loader = Loader::getInstance(isset($this->_options['local_library']) ? $this->_options['local_library'] : '', G::iniGet('yaf.library'));
     if ($loader == null || !$loader instanceof Loader) {
         throw new Exception\StartupError('Initialization of application auto loader failed');
     }
     if (isset($this->_options['local_namespace']) && $this->_options['local_namespace'] != '') {
         $namespace = str_replace(array(',', ' '), array(':', ':'), $this->_options['local_namespace']);
         $loader->registerLocalNamespace($namespace);
     }
     self::$_app = $this;
     if (G::get('throwException') == false) {
         set_exception_handler(array($this, 'exceptionHandler'));
     }
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:38,代码来源:Application.php

示例2: getController

 private function getController($appDir, $module, $controller)
 {
     $controllerDir = '';
     if ($this->_default_module == $module) {
         $controllerDir = $appDir . DIRECTORY_SEPARATOR . Loader::YAF_CONTROLLER_DIRECTORY_NAME;
     } else {
         $controllerDir = $appDir . DIRECTORY_SEPARATOR . Loader::YAF_MODULE_DIRECTORY_NAME . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . Loader::YAF_CONTROLLER_DIRECTORY_NAME;
     }
     $nameSeparator = G::iniGet('yaf.name_separator');
     if (G::iniGet('yaf.name_suffix') == true) {
         $classname = $controller . $nameSeparator . 'Controller';
     } else {
         $classname = 'Controller' . $nameSeparator . $controller;
     }
     if (!@class_exists($classname, false)) {
         if (!Loader::getInstance()->internal_autoload($controller, $controllerDir)) {
             throw new Exception\LoadFailed\Controller('Could not find controller script ' . $controllerDir . DIRECTORY_SEPARATOR . $controller . '.' . G::get('ext'));
         }
     }
     if (!class_exists($classname, false)) {
         throw new Exception\LoadFailed\LoadFailed('Could not find class ' . $classname . ' in controller script ' . $controllerDir);
     }
     return $classname;
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:24,代码来源:Dispatcher.php

示例3: _getRouteFromArray

 /**
  * Get a route from an array
  *
  * @param  array $info
  *
  * @return Yaf_Route_Interface
  */
 protected function _getRouteFromArray(array $info)
 {
     $useNamespace = G::iniGet('yaf.use_namespace');
     if ($useNamespace) {
         $class = isset($info['type']) ? '\\Yaf\\Route\\' . ucfirst($info['type']) : '\\Yaf\\Route\\Static';
     } else {
         $class = isset($info['type']) ? 'Yaf_Route_' . ucfirst($info['type']) : 'Yaf_Route_Static';
     }
     try {
         $route = call_user_func(array($class, 'getInstance'), $info);
     } catch (\Exception $e) {
         return null;
     }
     return $route;
 }
开发者ID:liu33851861,项目名称:CZD_Yaf_Extension,代码行数:22,代码来源:Router.php

示例4: route

 /**
  * Processes a request and sets its controller and action.  If
  * no route was possible, default route is set.
  *
  * @param  Yaf_Request_Abstract
  * @return Yaf_Request_Abstract|boolean
  */
 public function route(Request_Abstract $request)
 {
     $requestUri = $request->getRequestUri();
     $baseuri = $request->getBaseUri();
     if ($requestUri != '' && $baseuri != '' && stripos($requestUri, $baseuri) === 0) {
         $path = substr($requestUri, strlen($baseuri));
     } else {
         $path = $requestUri;
     }
     $module = null;
     $controller = null;
     $action = null;
     $rest = null;
     $path = trim($path, Router::URI_DELIMITER);
     if ($path != '') {
         $path = explode(Router::URI_DELIMITER, $path);
         $path = array_filter($path, 'strlen');
         if (Application::isModuleName($path[0])) {
             $module = $path[0];
             array_shift($path);
         }
         if (count($path) && !empty($path[0])) {
             $controller = $path[0];
             array_shift($path);
         }
         if (count($path) && !empty($path[0])) {
             $action = $path[0];
             array_shift($path);
         }
         $rest = implode(Router::URI_DELIMITER, $path);
         $actionPrefer = G::iniGet('yaf.action_prefer');
         if ($module == null && $controller == null && $action == null) {
             if ($actionPrefer == true) {
                 $action = $rest;
             } else {
                 $controller = $rest;
             }
             $rest = null;
         } elseif ($module == null && $action == null && $rest == null) {
             if ($actionPrefer == true) {
                 $action = $controller;
                 $controller = null;
             }
         } elseif ($controller == null && $action == null && $rest != null) {
             $controller = $module;
             $action = $rest;
             $module = null;
             $rest = null;
         } elseif ($action == null && $rest == null) {
             $action = $controller;
             $controller = $module;
             $module = null;
         } elseif ($controller == null && $action == null) {
             $controller = $module;
             $action = $rest;
             $module = null;
             $rest = null;
         } elseif ($action == null) {
             $action = $rest;
             $rest = null;
         }
         if ($module != null) {
             $request->setModuleName($module);
         }
         if ($controller != null) {
             $request->setControllerName($controller);
         }
         if ($action != null) {
             $request->setActionName($action);
         }
         $params = array();
         if ($rest != null && trim($rest) != '') {
             $path = explode(Router::URI_DELIMITER, $rest);
             if (($numSegs = count($path)) != 0) {
                 for ($i = 0; $i < $numSegs; $i = $i + 2) {
                     $key = urldecode($path[$i]);
                     $val = isset($path[$i + 1]) ? urldecode($path[$i + 1]) : null;
                     $params[$key] = isset($params[$key]) ? array_merge((array) $params[$key], array($val)) : $val;
                 }
             }
             $request->setParam($params);
         }
     }
     return true;
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:92,代码来源:Static.php

示例5: resolveClass

 private function resolveClass($class)
 {
     // Autodiscover the path from the class name
     // Implementation is PHP namespace-aware, and based on
     // Framework Interop Group reference implementation:
     // http://groups.google.com/group/php-standards/web/psr-0-final-proposal
     $className = ltrim($class, '\\');
     $file = '';
     $namespace = '';
     if (($lastNsPos = strripos($className, '\\')) !== false) {
         $namespace = substr($className, 0, $lastNsPos);
         $className = substr($className, $lastNsPos + 1);
         $file = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
     }
     if (G::iniGet('yaf.lowcase_path') == true) {
         $file = strtolower($file);
         $segments = explode('_', $className);
         foreach ($segments as $key => &$value) {
             if ($key != count($segments) - 1) {
                 $value = strtolower($value);
             }
         }
         $file .= implode(DIRECTORY_SEPARATOR, $segments) . '.' . G::get('ext');
     } else {
         $file .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.' . G::get('ext');
     }
     return $file;
 }
开发者ID:liu33851861,项目名称:CZD_Yaf_Extension,代码行数:28,代码来源:Loader.php


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