php Àà×Ô¶¯ÔØÈëµÄ·½·¨

6年以前  |  阅读数:952 次  |  编程语言:PHP 

php Àa×Ô¶¯ÔØÈe½¨


    <?php
    class inload 
    {
    /**
       * Àa×Ô¶¯ÔØÈe£¬²»ÐeÒªÓÉ¿ª*¢Õßµ÷ÓÃ
       *
       * @param string $class ÀaÎļþ
       */
      private function autoload( $class )
      {
        if( empty($class) )
        {
          throw new QException('¼ÓÔØÎļþ²»´aeÔÚ'.$class);
        }
        else
        {  
          require _SPRING_.'/_Core/SpringMap.php'; //¿o¼ÜµØÍ¼
          if(! file_exists( $source[$class]['file'] ) )
          {
            throw new QException('¼ÓÔØÎļþ²»´aeÔÚ'.$class);
          } 
          require $source[$class]['file'];
        }
      }

      /**
       * ×¢²a»oÈ¡Ïu×¢²aÒ»¸o×Ô¶¯ÀaÔØÈe*½*¨
       *
       * ¸Ã*½*¨²Î¿¼ Zend Framework
       *
       * @param string $class Ìa¹(C)×Ô¶¯ÔØÈe*þÎñµÄÀa
       * @param boolean $enabled ÆoÓûo½uÓøÃ*þÎñ
       */
      private function registerAutoload($class = 'Interpreter' , $enabled = true)
      {
        if (!function_exists('spl_autoload_register'))
        {
          throw new QException('spl_autoload ²»´aeÔÚÕa¸oPHPµÄ°²×°');
        }
        if ($enabled === true)
        {
          spl_autoload_register(array($class, 'autoload'));
        }
        else
        {
          spl_autoload_unregister(array($class, 'autoload'));
        }
      }

      /**
      * Îo¹¹º¯Êý
      */
      public function __destruct()
      {
        self::registerAutoload('Interpreter' , false);
      }  

ÒÔÉÏËuÊo¾ÍÊDZ¾ÎĵÄÈ«²¿ÄÚÈÝÁË£¬Ï£Íu´o¼ÒÄܹ»Ï²»¶¡£

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8