A Scripting Language for Web, Linux and Windows

A Scripting Language for Web, Linux and Windows

Web functions

V1 can be used as CGI interpreter. Therefore you have to configurate your Webserver to call v1 -w (with -w option) for every file which should be interpretated with V1.

In Web mode V1 will create the following global Arrays. The name and format of the arrays are compatible to theire PHP pendants.

Name of Array Description
_GET Contain all URL parameters and <form method="get"> values as key / value pairs.
_POST Contain all <form method="post"> values as key / value pairs.
_REQUEST Aggregation of _GET and _POST. Contain all request values as key / value pairs.
_FILES Contain the uploaded filenames. For further information about file uploads read PHP file upload.

In difference to PHP, V1 has no _SERVER array. To get CGI environment variables you have to use the getenv () function. For example getenv('SCRIPT_FILENAME') get the current V1 filename. More Information about possible CGI variables: https://en.wikipedia.org/wiki/Common_Gateway_Interface

The following Web specific functions are supported. The functions are compatible with theire PHP pendants.

Function/Arguments Return Description
header (string header) bool Set a HTTP header. The header () function need to be called before any other output from print() or document text outside the <?v1 ?> tags is sent to the client. For example: header ("Location: /newpath") will cause a HTTP redirect. On success true is returned.
htmlspecialchars (string string) string Return a HTML compatible string. Characters & < > " will be replaced with HTML characters.
nl2br (string string) string Replace all line feeds with HTML <br> in the given string and return.
url_encode (string string) string Encode a given string to URL format and return. All incompatible characters will be encoded with %XX values.
url_decode (string string) string Decode a given URL formatted string to plain text and return.
is_uploaded_file (string filename) bool Same as PHP function is_uploaded_file(). The function will return true if the given filename was uploaded with HTTP.
move_uploaded_file (string filename, string destination) bool Same as PHP function move_uploaded_file(). The function will move the uploaded filename from temporary path to destination path.
json_encode (array array) string Encode array to JSON format and return.
json_decode (string string) array Decode JSON formatted string to array and return. If JSON format is bad then false is returned.
base64_encode (string string) string Encode string to BASE64 format and return.
base64_decode (string string) string Decode BASE64 formatted string to plain text and return. On error empty string is returned.

back to Home

V1 Version 0.95 - Documentation generated Sat, 09 Feb 2019 15:30