base_url()
Returns with the `app.base_url` config value
base_url() : string
Return values
string —The base URL
Returns with the `app.base_url` config value
base_url() : string
The base URL
Returns with a URL for the given URI
url(string $uri[, bool $withMTime = true ]) : string
For example, if your app.base_url
is http://example.com and the given $uri is "/static/script.js",
the result will be: http://example.com/static/script.js?123123123
The number at the end is the modification timestamp of the file.
If the $withMTime
parameter is false the result will not contain the question mark and the timestamp.
The URI
Are you need a modification time at the end?
The full URL
Returns with a URL for the given route
route_url(string $route[, array<string|int, mixed> $params = [] ][, string $amp = '&' ]) : string
Heavily depends on the configuration of the application.
For example, if the given $route
is '/example-route', the $params
is an associative array ['name' => 'joe'],
you have a multi locale config, the app.use_rewrite
set to true and app.base_url
is 'http://example.com'
then the result will be: 'http://example.com/en/example-route?name=joe'
The route
The HTTP query parameters for the route
The ampersand symbol. The default is '&' but you can change it to '&' if needed.
The full URL for the route
Returns with a safe HTML string
esc_html(string $text) : string
For example: if the $text
is '<script>Evil script</script>'
the result will be '<script>Evil script</script>'
The text for escaping
The HTML escaped string
Returns with a safe HTML attribute value
esc_attr(string $value) : string
For example: if the $value
is '"something"' with the double quotes
the result will be '"something"'
The value for escaping
The safe HTML attribute value
Returns with a safe HTML attributes string
esc_attrs(array<string|int, mixed> $attributes[, bool $startWithSpace = true ]) : string
For example, the following call:
esc_attrs(['name1' => 'value1', 'name2' = '"', 'name3']);
will return with 'name1="value1" name2=""" name3'
should the result start with a space?
The HTML attributes string
Returns with a translated text
tr(string $id) : string
For example: if the application is configured with multi locale in the config.ini.php:
translation.all = en, hu translation.default = en
The current locale is "en" and you added a translation directory with namespace "example" and the directory contains an en.ini with the following content:
hello = "Welcome {name}!"
Calling tr('example:hello', ['name' => 'Joe'])
will return 'Welcome Joe!'
The ID of the text "namespace:text_id"
The translated text