Generic
in package
Generic Class
The Generic class provides various utility functions.
Table of Contents
Methods
- baseURL() : string
- Get the base URL of the current page.
- getRandomNumber() : string
- Generate a random number.
- getRandomString() : string
- Generate a random string.
- userIP() : string
- Get the client's IP address.
Methods
baseURL()
Get the base URL of the current page.
public
static baseURL() : string
Return values
string —The base URL of the current page.
getRandomNumber()
Generate a random number.
public
static getRandomNumber([int $length = 5 ]) : string
Parameters
- $length : int = 5
-
The length of the random number.
Return values
string —The generated random number.
getRandomString()
Generate a random string.
public
static getRandomString([int $length = 5 ]) : string
Parameters
- $length : int = 5
-
The length of the random string.
Return values
string —The generated random string.
userIP()
Get the client's IP address.
public
static userIP() : string
This function detects the client's IP address from various sources, including HTTP headers.
Return values
string —The client's IP address.