PHP Excellent framework CodeIgniter Learning Series--ci_input class Learning

Source: Internet
Author: User
Tags codeigniter

This article mainly introduces CI Core Framework tool class Ci_input.
According to the CI document's own definition, this class is used to:

    • Handle global variables ahead of time to ensure security;
    • Provides some help functions for working with input data.

The following key methods in the Select class are described.

__construct ()

The constructor, by definition, is used to determine whether global XSS processing is turned on and whether the $_get array is allowed.
Call the function $this->_sanitize_globals(); to clean up the data in $_get,$_post, $COOKIE, $_server[' php_self ']. Used primarily to detect the presence of illegal characters in key names and key values to prevent XSS attacks.
The security class ci_security is also transferred for CRSF defense.

        // CSRF Protection check        if ($this->_enable_csrf === TRUE && ! is_cli())        {            $this->security->csrf_verify();        }
Reading input variables

The main methods are:

    • $this->input->post ()
    • $this->input->get ()
    • $this->input->cookie ()
    • $this->input->server ()

At the same time you can also use php://input or $this->input->raw_input_stream; to get raw data.

Other tool functions

For example:

    • Is_cli_request ()
    • Is_ajax_request ()
    • Get_request_header ()

Wait a minute.

PHP Excellent framework CodeIgniter Learning Series--ci_input class Learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.