URL Library



( ZN >= 3.1.0 )

It is a library built to perform functions such as working with URL strings, coding, decoding and parsing.

 

# Methods


String base ( String $ uri = '' , Int $ index = 0 )
String site ( String $ uri = '' , Int $ index = 0 )
String current ( String $ fix = NULL )
String host ( String $ uri = '' )
String prev ( Void )
String In base64deco ( string $ data , Boolean $ strict = false )
String base64Encode ( String $ data )
Array headers ( String $ url , Int $ format = 0 )
Array metatags ( string $ filename , boolean $ useıncludepath = false )
String buildQuery ( Mixed $ data , Mixed  $ prefix = NULL , Scalar $ sep  = NULL , Scalar $ enctype = RFC1738
String rawDecode ( String $ str )
String rawEncode ( String $ str )
String decode ( String $ str )
String encode ( String $ str )

 

# Base ( ZN >= 3.1.0 )


Returns the root URL of the system. That is, the URL information is the directory where the system is installed.

Parameters

String $ uri = '' The data to be appended to the root URL obtained.
return String

Use of

echo URL::base();
https: // localhost / developer /
echo URL::base('about/me');
https: // localhost / developer / about / mA

 

# Site ( ZN >= 3.1.0 )


Existing progeny URLs'.

Parameters

String $ uri = '' The data to be appended to the root URL obtained.
return String

Use of

For example Projects / Example / Let's think about working in the directory.

echo URL::site();
https: // localhost / developer / example /

Predefined Projects / Frontend directory. 

echo URL::site();
https: // localhost / developer /
echo URL::site('users/profile');
https: // localhost / developer / users / profile

 

# Current ( ZN >= 3.1.0 )


The currently active page URLs'.

Parameters

String $ uri = NULL The data to be added to the active URL obtained.
return String

Use of

echo URL::current('about/me');
https: // localhost / developer / example / about / mA  

 

# Host ( ZN> = 3.1.0 )


The system gives the host information. The difference from the host () function is the URL.

Parameters

String $ uri = NULL The data to be added at the end of the host information.
return String

Use of

echo URL::host('about/me');
https: // localhost / about / mA 

 

# Prev ( ZN >= 3.1.0 )


Returns the URL of the current URL from which the active URL is addressed. So the visitor is the URL address.

Parameters

void
return String

Use of

echo URL::prev();
https: // localhost / about / mA 

 

# Base64Decode ( ZN >= 3.1.0 )


Its use with base64_decode () is the same. MIME decodes base64 encoded data.

Parameters

String $ data The data to be resolved.
Bool $ strict = false If the input contains characters outside of the base64 alphabet, it returns FALSE .
return String

Use of

$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo URL::base64Decode($str);
This is an encoded string 

 

# Base64Encode ( ZN >= 3.1.0 )


Its use with base64_encode () is the same. It encodes the data in MIME base64.

Parameters

String $ data The data to be resolved.
return String

Use of

echo URL::base64Encode('This is an encoded string');
== vghpcybpcybhbiblbmnvzgvkıhn0cmluzw 

 

# Headers ( ZN >= 3.1.0 )


Bring back all the headers sent by the server in response to an HTTP request.

Parameters

String $ data Destination URL.
Int $ format = 0 If the optional format parameter is set to zero, URL :: headers () parses the response and sets the index keys.
return Array

Use of

output(URL::headers('https://www.example.com'));
0 => string "HTTP / 1.1 200 OK ' (length = 17 ) ,
1 => string " Date: Thu, 09 Mar 2017 14:58:05 GMT' (length = 37 ) ,
2 => string 'Server: Apache ' (length = 16 ) ,
3 => string ' X-Powered-By: PHP / 7.0.15 ' (length = 26 ) ,
4 => string ' Expires: Thu, 19Nov 1981 08:52:00 GMT ' (length = 40 ) ,
5 => string "Cache-Control: no-store, no-cache, must-revalidate' (length = 52 ) ,
6 => string " Pragma: no -cache ' (length = 18 ) ,
7 => string ' Set-Cookie: PHPSESSID = i4ceuvv7b8h844da2h3k6hja05; path = / ' (length = 58 ) ,
8 => string "X-Mod-Pagespeed: 1.12.34.1-0' (length = 30 ),
9 => string "X-Powered-By: pleskl the ' (length = 24 ) ,
10 => string " Vary: Accept-Encoding' (length = 23 ) ,
11 => string "Cache-Control: max-age = 0, no-cache, s-maxag = 10 ' (length = 49 ) ,
12 => string "Content-Length: 56856' (length = 23 ) ,
13 => string " Connection: close ' (length = 19 ),
14 => string 'Content-Type: text / html ; charset = utf-8 ' (length = 40 )
 

 

# MetaTags ( ZN >= 3.1.0 )


Extracts all meta tag content attributes from a file and returns a sequence.

Parameters

String $ Filename A string path for the HTML file. This can be a local file or a URL.
Bool $ useIncludepath = false TRUESetting it to this value will cause PHP to try to open the file along the standard include path according to the include_path directive. This is used for local files, not URLs.
return Array

Use of

output(URL::metaTags('https://www.example.com'));
viewport => string 'width = device-width, initial-scale = 1' (length = 37 )

 

# BuildQuery ( ZN> = 3.1.0 )


Generates a URL-encoded query string.

Parameters

Mixed $ data It can be an array or object containing a property.
String $ prefix = NULL If basic string numeric indexes are used and this parameter is met, then only the element for the base string is preceded by the numeric index.
String $ separator = NULL Brackets.
String $ enctype = 'RFC1738' Reference type.
return String

Use of

$data =


[
    'foo'=>'bar',
    'baz'=>'boom',
    'cow'=>'milk',
    'php'=>'hypertext processor'
];

echo URL::buildQuery($data, '', '&');
foo = bar & baz = Boom & cow milk & PHP = + = hypertext processor 

 

# Parse ( ZN> = 3.1.0 )


Parses a URL to restore its components.

Parameters

String $ url URL to parse. Replace with invalid characters _.
scaler $ component = 1 Component. The options given below for this parameter can also be used as string 'scheme' instead of PHP_URL_SCHEME .
Options PHP_URL_SCHEME, PHP_URL_HOST, PHP_URL_PORT, PHP_URL_USER, PHP_URL_PASS, PHP_URL_PATH, PHP_URL_QUERY, PHP_URL_FRAGMENT
return Mixed

Use of

$url = 'https://username:password@hostname:9090/path?arg=value#anchor';

output(URL::parse($url));
output(URL::parse($url, 'scheme'));
hostname
http

 

# RawDecode ( ZN >= 3.1.0 )


It decodes URL encoded strings.

Parameters

String $ Str The URL to resolve.
return String

Use of

echo URL::rawDecode('foo%20bar%40baz');
foo bar @ baz 

 

# RawEncode ( ZN >= 3.1.0 )


URL codes according to RFC 3986.

Parameters

String $ Str URL to be encoded.
return String

Use of

echo URL::rawEncode('foo @+%/');
foo% 20% 40% 25% 2F% 2B

 

# Encode ( ZN >= 3.1.0 )


The URL encodes the URL.

Parameters

String $ Str URL to be encoded.
return String

Use of

echo URL::encode('https://www.example.com');
http% 3A% 2F% 2Fwww.example.co I 

 

# Decode ( ZN >= 3.1.0 )


It decodes the URL-encoded string.

Parameters

String $ Str The URL to resolve.
return String

Use of

echo URL::decode('http%3A%2F%2Fwww.example.com');
I https://www.example.co