Exemple #1
0
 /**
  * 构造函数
  */
 public function __construct(array $data = null)
 {
     self::throwWarnings();
     self::$app = $this;
     $this->importer = Importer::getInstance();
     $this->storage = new Storage($data);
     $this->initiate();
 }
Exemple #2
0
 /**
  * 启动并缓存app实例
  */
 function app($settings_file = '')
 {
     static $app = null;
     if (is_null($app) && $settings_file) {
         $importer = \Cute\Importer::getInstance();
         $importer->addNamespace('Cute', SRC_ROOT);
         $storage = \Cute\Base\Storage::newInstance($settings_file);
         $class = constant('APP_CLASS');
         $app = new $class($storage);
         $app->install($importer, array('import' => 'addNamespace'));
         $app->initialize();
     }
     return $app;
 }
Exemple #3
0
 function app($sD = '')
 {
     static $j = null;
     if (is_null($j) && $sD) {
         $XD = \Cute\Importer::getInstance();
         $XD->addNamespace('Cute', SRC_ROOT);
         $tB = \Cute\Base\Storage::newInstance($sD);
         $H = constant('APP_CLASS');
         $j = new $H($tB);
         $j->install($XD, array('import' => 'addNamespace'));
         $j->initialize();
     }
     return $j;
 }
Exemple #4
0
 public function setUp()
 {
     $this->importer = Importer::getInstance();
 }
Exemple #5
0
 */
namespace {
    // 要求PHP5.4以上版本
    if (version_compare(PHP_VERSION, '5.4.0') < 0) {
        die('PHP最低要求5.4版本');
    }
    defined('SRC_ROOT') or define('SRC_ROOT', __DIR__);
    defined('VENDOR_ROOT') or define('VENDOR_ROOT', dirname(SRC_ROOT) . '/vendor');
    defined('SQL_VERBOSE') or define('SQL_VERBOSE', true);
    //是否记录执行过的SQL语句
    defined('ERROR_LEVEL') or define('ERROR_LEVEL', E_ALL & ~E_DEPRECATED & ~E_NOTICE);
    @error_reporting(ERROR_LEVEL);
    if (!class_exists('\\Cute\\Importer')) {
        require_once SRC_ROOT . '/Cute/Importer.php';
    }
    \Cute\Importer::getInstance();
    /**
     * 启动并缓存app实例
     */
    function app()
    {
        return \Cute\Application::$app;
    }
    /**
     * 开始的字符串相同
     *
     * @param string $haystack 可能包含子串的字符串
     * @param string $needle 要查找的子串
     * @return bool
     */
    function starts_with($haystack, $needle)