<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 注冊自動加載機制 注冊自動加載機制文件位于`thinkphp/library/think/Loader.php`,在`base.php`文件中,調用了`register()`方法,具體內容如下: ``` /** * 注冊自動加載機制 * @access public * @param callable $autoload 自動加載處理方法 * @return void */ public static function register($autoload = null) { // 1. spl_autoload_register 函數是注冊給定的函數作為 __autoload 的實現 spl_autoload_register($autoload ?: 'think\\Loader::autoload', true, true); // Composer 自動加載支持 // 2. VENDOR_PATH = /WWW/tp5/vendor/ , 檢查/WWW/tp5/vendor/composer是否存在,默認存在 if (is_dir(VENDOR_PATH . 'composer')) { // 3. php版本必須大于5.6, /WWW/tp5/vendor/composer/autoload_static.php 必須存在 if (PHP_VERSION_ID >= 50600 && is_file(VENDOR_PATH . 'composer' . DS . 'autoload_static.php')) { require VENDOR_PATH . 'composer' . DS . 'autoload_static.php'; // 4. get_declared_classes 函數返回由已定義類的名字所組成的數組 $declaredClass = get_declared_classes(); /* print_r($declaredClass); Array ( [0] => stdClass [1] => stdClass [2] => Exception [3] => ErrorException [4] .... other defined classes.... [143] => XSLTProcessor [144] => think\Loader [145] => Composer\Autoload\ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd ) */ // 5. 獲取composer類, array_pop 函數是彈出數組最后一個單元(出棧) $composerClass = array_pop($declaredClass); /* print_r($composerClass); Composer\Autoload\ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd */ foreach (['prefixLengthsPsr4', 'prefixDirsPsr4', 'fallbackDirsPsr4', 'prefixesPsr0', 'fallbackDirsPsr0', 'classMap', 'files'] as $attr) { // 6. property_exists 函數是檢查對象或類是否具有該屬性, 并創建當前實例類的屬性 if (property_exists($composerClass, $attr)) { self::${$attr} = $composerClass::${$attr}; } } } else { // 可以暫時忽略此代碼邏輯 self::registerComposerLoader(); } } /* print_r(self::$prefixLengthsPsr4); Array ( [t] => Array ( [think\worker\] => 13 [think\oracle\] => 13 [think\mongo\] => 12 [think\migration\] => 16 [think\helper\] => 13 [think\composer\] => 15 [think\captcha\] => 14 [think\] => 6 ) [a] => Array ( [app\] => 4 ) [W] => Array ( [Workerman\] => 10 ) [P] => Array ( [Phinx\] => 6 ) ) */ // 7. 注冊命名空間定義, 框架默認只有 think, traits, 沒有behavior self::addNamespace([ 'think' => LIB_PATH . 'think' . DS, 'behavior' => LIB_PATH . 'behavior' . DS, 'traits' => LIB_PATH . 'traits' . DS, ]); // 8. 加載類庫映射文件, 可以忽略(默認沒這文件) if (is_file(RUNTIME_PATH . 'classmap' . EXT)) { self::addClassMap(__include_file(RUNTIME_PATH . 'classmap' . EXT)); } // 9. 加載composer自動加載文件 self::loadComposerAutoloadFiles(); // 自動加載 extend 目錄 self::$fallbackDirsPsr4[] = rtrim(EXTEND_PATH, DS); // /WWW/tp5/extend/ /* print_r(self::$fallbackDirsPsr4); Array ( [0] => /mnt/d/phpStudy/PHPTutorial/WWW/tp5/extend ) */ } ``` ![](https://img.kancloud.cn/1d/69/1d69987e7818d0a091dd33c8f91b8eea_793x576.png)
                  <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>

                              哎呀哎呀视频在线观看