Home  >  Article  >  Backend Development  >  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中文网
PHP中文网Original
2017-03-24 15:12:023626browse

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

A note about Laravel Route redirection

Statement:
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