Home >Backend Development >PHP Tutorial >In the Laravel framework, what is the difference between {{url}} and {{asset}}?
Question:
In the Laravel framework, what is the difference between {{url}} and {{asset}}?
Solution 1:
function url($path = null, $parameters = [], $secure = null) function asset($path, $secure = null)
Generally, assets are used to reference static files css js img, etc.
Solution 2: The
asset() method is used to introduce files such as CSS/JavaScript/images. The files must be stored in the public file directory.
url() method generates a complete URL.
Related articles:
The use of named routes in laravel
Exploring the problem that Laravel uses the env function to read environment variables as null