当前位置:网站首页>How can laravel get the public path

How can laravel get the public path

2022-07-07 16:20:00 Full stack programmer webmaster

app_path()

app_path The function returns app The absolute path to the directory :
$path = app_path();

 You can still use it app_path The function is relative to app The given file of the directory generates an absolute path :
$path = app_path('Http/Controllers/Controller.php');

base_path()

base_path Function returns the absolute path of the project root directory :
$path = base_path();

 You can still use it base_path The function generates an absolute path for a given file relative to the application directory :
$path = base_path('vendor/bin');

config_path()

config_path Function returns the absolute path of the application configuration directory :
$path = config_path();

database_path()

database_path Function returns the absolute path of the application database directory :
$path = database_path();

public_path()

public_path The function returns public The absolute path to the directory :
$path = public_path();

storage_path()

storage_path The function returns storage The absolute path to the directory :
$path = storage_path();

 You can also use storage_path Function generation relative to storage The absolute path of the given file of the directory :
$path = storage_path('app/file.txt');

 obtain laravel The built-in help functions of the project path are basically here 

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113203.html Link to the original text :https://javaforall.cn

原网站

版权声明
本文为[Full stack programmer webmaster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071406057290.html