Lavavel 取得各路徑方法

2022-11-11
取得控制器路徑
//取得app路徑
$path = app_path(); 

//取得抹個控制器的路徑
$path = app_path('Http/Controllers/Controller.php');

//取得模型路徑
$path = app_path('Http/Models/Model.php');

取得跟目錄
$path = base_path();
 
$path = base_path('vendor/bin');

取得設定值路徑
$path = config_path();
 
$path = config_path('app.php');

取得資料庫路徑
$path = database_path();
 
$path = database_path('factories/UserFactory.php');

取得語言路徑
$path = lang_path();
 
$path = lang_path('en/messages.php');

取得laravel mix對應檔案路徑
$path = mix('css/app.css');

取得public資料夾路徑
$path = public_path();
 
$path = public_path('css/app.css');

取得resource資料夾路徑
$path = resource_path();
 
$path = resource_path('sass/app.scss');

取得storage資料夾路徑
$path = storage_path();
 
$path = storage_path('app/file.txt');

Contact

Github

Codepen

歡迎參觀我的賣場
© 2013 Copyright Digishot Web | Design Tools
Visitors【702737】
digishot webdesign studio