KScript documentazione
IT

Lingua

Tradotto automaticamente dall’inglese, che è la versione originale.

Pagine web

La richiesta

$request contiene la richiesta a cui una pagina sta rispondendo: method, scheme, path, url, query, form, headers, cookies, params e body. Per https://example.com/people?page=2, $request.scheme è https, $request.path è /people e $request.url è /people?page=2:

Pagina HTML
<let name="page" value="($request.query.page ?? '1')->to_number(default: 1)" />
<p>Page {$page} of the people list, at {$request.path}</p>

Un valore in query o form è testo. Un nome inviato più volte (?tag=a&tag=b, o un gruppo di checkbox) è una lista di testi. Per un normale invio di form, body è il testo così come inviato (name=Ada&tag=a). Per un form con file è vuoto. Una pagina sotto un prefisso di locale riceve anche $request.locale.

Edit this page on GitHub