如果您想重命名您的应用程序文件夹,这只是其中几种方法之一。
php artisan app:name YourNamespace
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 to the application "app" directory.
*
* @return string
*/
public function path()
{
return $this->basePath.DIRECTORY_SEPARATOR.$this->appBasePath;
}
}
5)保存文件并打开app.php
6)并使用以下
替换您的应用程序引导程序 // load our local application
require __DIR__.'/application.php';
// instaniate our application
$app = new \Application(
realpath(__DIR__.'/../')
);
// set the path to match the namespace
$app->setAppPath('YourNamespace');
7)保存你的app.php就是这样,请记住你应该把它添加到你的测试中。
希望这有助于任何想要更改其命名空间并希望它与目录结构匹配的人。