<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 開發規范 ### 命名規范 文件名大小寫要一致,否則上傳到Linux服務器將無法解析 框架類以及函數命名規則為駝峰,如: getField 常量以大寫字母與下劃線組合 如 APP_PATH 數據庫與數據表使用小寫字母與下劃線組合,如 aa_user ### 開發建議 盡量遵守框架命名規范 開發過程中開啟DEBUG模式,有助于快速分析錯誤 ### 良好的編程風格和注釋,如: ~~~ <?php namespace aaphp; /** * 配置 * Class Config * @package aaphp * @method mixed common(string $key = '', string $value = '') static 公共配置文件 * @method mixed database(string $key = '', string $value = '') static 數據庫配置文件 * @method mixed router(string $key = '', string $value = '') static 路由配置文件 * @method mixed param(string $key = '', string $value = '') static 自定義參數配置文件 */ final class Config { /** * @var object 對象實例 單例 */ private static $instance; /** * @var array 保存全部的配置信息,多維數組 */ private static $config = []; /** * 單例模式,獲取自身實例化對象 * @return object [自身實例化對象] */ public static function instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } /** * 保護,防止外部實例化,單例模式 */ protected function __construct() { // 讀取 ./config下面的所有配置文件 $fileList = scandir(USER_CONFIG_PATH); foreach ($fileList as $key => $value) { if ('.php' == strchr($value, '.php')) { $configPath = USER_CONFIG_PATH . '/' . $value; // 引入 $config = include_once($configPath); $key = str_replace('.php', '', $value); // 保存配置內容 self::$config[$key] = $config; } } } /** * 配置信息的讀取或修改 * @param $type [配置文件名稱(不包含后綴名)例子:Config::common('default_moduel');] * @param string $key [配置文件的鍵名] * @param string $value [配置文件的值] * @return array|string [配置文件信息] */ public function config($type, $key = '', $value = '') { if ('' == $key) {// 什么都不傳,則返回所有配置項信息 return self::$config[$type]; } else if ('' != $key && '' == $value) {// 只傳了$key,則返回對應value if (isset(self::$config[$type][$key])) { return self::$config[$type][$key]; } else { return ''; } } else {// $key和$value都傳,則是臨時設置配置的值 self::$config[$type][$key] = $value; } } /** * 使方法可以被靜態調用 例子:Config::common('default_moduel'); * @param string $function [需要調用的方法] * @param array $arguments [參數數組] * @return mixed|string [配置文件信息] */ public static function __callStatic($function, $arguments) { $class = Config::instance(); $key = array_shift($arguments); $value = array_shift($arguments); if (!isset(self::$config[$function])) { Error::halt(USER_CONFIG_PATH . '/' . $function . '.php 不存在'); } return $class->config($function, $key, $value); } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看