08.10.2017 Views

codeigniter_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CodeIgniter<br />

Syntax<br />

html_escape($var)<br />

Parameters $var (mixed) – Variable to escape (string or array)<br />

Return<br />

HTML escaped string(s)<br />

Return type mixed<br />

Description<br />

This function acts as a native PHP htmlspecialchars()<br />

function.<br />

Syntax<br />

Return<br />

Return type<br />

Description<br />

get_mimes()<br />

An associative array of file types<br />

array<br />

This function returns a reference to the MIMEs array from<br />

application/config/mimes.php.<br />

Syntax<br />

Return<br />

Return type<br />

Description<br />

is_https()<br />

TRUE if currently using HTTP-over-SSL, FALSE if not<br />

bool<br />

Returns TRUE if a secure (HTTPS) connection is used and<br />

FALSE in any other case (including non-HTTP requests).<br />

Syntax<br />

Return<br />

Return type<br />

Description<br />

is_cli()<br />

TRUE if currently running under CLI, FALSE otherwise<br />

bool<br />

Returns TRUE if the application is run through the command<br />

line and FALSE if not.<br />

Syntax<br />

function_usable($function_name)<br />

Parameters $function_name (string) – Function name<br />

Return type bool<br />

Description<br />

Returns TRUE if a function exists and is usable, FALSE<br />

otherwise.<br />

Given below is an example, which demonstrates all of the above functions.<br />

Example<br />

Here we have created only one controller in which we will use the above functions. Copy<br />

the below given code and save it at<br />

application/controller/CommonFun_Controller.php.<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!