小编new*_*ton的帖子

laravel 5更改app目录以匹配命名空间

如果您想重命名您的应用程序文件夹,这只是其中几种方法之一.

  • 1)跑 php artisan app:name YourNamespace
  • 2)将您的app文件夹重命名为YourNamespace
  • 3)在你的bootstrap文件夹中创建一个名为application.php的文件
  • 4)将其粘贴在那里

    class Application extends Illuminate\Foundation\Application {
    
        /**
         * this is the default for the application path
         */
        protected $appBasePath = 'app';
    
        public function __construct($basePath = null)
        {
            $this->registerBaseBindings();
    
            $this->registerBaseServiceProviders();
    
            $this->registerCoreContainerAliases();
    
            if ($basePath) $this->setBasePath($basePath);
        }
    
        public function setAppPath($path) {
            // store the path in the class only
            $this->appBasePath = $path;
    
            // set the path in the container (using this class's path to reset it)
            return app()->__set('path', $this->path());
        }
    
        /**
         * Get the path …
    Run Code Online (Sandbox Code Playgroud)

php directory namespaces laravel-5

8
推荐指数
0
解决办法
5334
查看次数

标签 统计

directory ×1

laravel-5 ×1

namespaces ×1

php ×1