| Viewed 17 times

How to get the path to the public directory in laravel


How to get the path to the public directory in laravel

1 Answer
Mohammad Qandeel
Answered
0

You can use the public_path() helper function to get the path to the public directory in laravel

For Laravel developers, the public directory is the place where you can put your assets such as images, JavaScript, and CSS and its contains the index.php file, which is the entry point for all requests entering your application

If you want to get the path to the public directory in laravel you can use the public_path() helper function which will return a string

Example of how to use public_path() helper function

$path = public_path();

Output (output difference based on your project)

"C:\xampp\htdocs\laravel\shop\public"

 


Related FAQ