예제 #1
0
 public function __construct()
 {
     $this->app = Facade::getFacadeApplication();
     $this->files = new Filesystem();
 }
예제 #2
0
 /**
  * 检查当前应用名称空间文件路径
  *
  * @param string $namespacePrefix
  * @param string $file
  * @return string;
  */
 protected function checkAppNamespaceFilePath($namespacePrefix, $file)
 {
     if (class_exists('Powernote\\Support\\Facades\\Facade') && Facade::getFacadeApplication() != null) {
         $app = Facade::getFacadeApplication();
         if ('App\\' == $namespacePrefix) {
             $path = str_replace($app['path.app'], '', $file);
             $fileName = pathinfo($file, PATHINFO_BASENAME);
             $exp = explode('/', $path);
             array_pop($exp);
             $path = strtolower(implode('/', $exp));
             return $app['path.app'] . $path . '/' . $fileName;
         }
     }
     return $file;
 }
예제 #3
0
파일: start.php 프로젝트: mejinke/powernote
use Powernote\Config\Config;
use Powernote\Routing\Automate;
use Powernote\Support\Facades\Router;
use Powernote\Support\Facades\Facade;
use Powernote\Autoloader\ClassLoader;
// 开启错误报告
error_reporting(E_ALL);
// 加载配置
$app->singleton('config', function ($container) use($app) {
    return new Config($app->getConfigLoader(), $app['env']);
});
$config = $app['config']['app'];
$app->singleton('app', $app);
// 设置APP
Facade::clearResolvedInstances();
Facade::setFacadeApplication($app);
// 安装路由
$app->installRoute($app['path.route']);
// 自动路由
if ($config['route.automate'] == true) {
    Router::add([new Automate()]);
}
//开启错误提示
if ($config['debug'] == true) {
    ini_set('display_errors', 'on');
}
//注册当前应用程序名称空间
ClassLoader::init()->addNamespace('App', $app['path.app'] . '/');
// 设置时区
date_default_timezone_set($config['timezone']);