Home > Backend Development > PHP Tutorial > In the Laravel framework, what is the difference between {{url}} and {{asset}}?

In the Laravel framework, what is the difference between {{url}} and {{asset}}?

PHP中文网
Release: 2023-03-01 08:10:01
Original
3688 people have browsed it

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)
Copy after login

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

A note about Laravel Route redirection

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template