PASSWORD RESET

Your destination for complete Tech news

How to get public path in Laravel?

566 0
< 1 min read

To get a public path in Laravel, you can use the public_path() function.

Here’s an example:

$path = public_path('file.txt');

This will return the full path to the file.txt file in the public directory.

You can also use the asset() function to generate a URL to a file in the public directory.

Here’s an example:

$url = asset('img/logo.png');

This will return a URL to the logo.png file in the public/img directory.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.