CI Framework, source code one-time judge get Postget data whether there is a field value is empty method source code soracá source code download LOL source generation

Source: Internet
Author: User
One, the following is the CI framework

1. Put all the fields you want to receive in the array

Cases:

I want to receive: fields such as Id,name,age,mobile

$req Array (' id ', ' name ', ' age ', ' mobile ');

2, for the loop to judge can

1  for ($i = 0; $i Count ($req); $i + + )    {2$j$this->load->get_post ($req[ $i],true); 3 if (empty($j)) 4 Exit ($req[$i]. ' Empty '); 5 $data [$i$j; 6 }7print_r($data);

Second, the source code judgment method (will not nonsense, directly on the code)

$req Array (' id ', ' name ', ' age ', ' mobile ');  for ($i = 0; $i Count ($req); $i + + )         {$j$_post[$req[$i]]     ; if (empty($j))              Exit ($req[$i]. ' Empty ');      $data [$i$j;}      Print_r ($data);

Conclusion:

In fact, the CI framework and source code can be used in the source code this method (ii), but in order to verify the security, the use of the first scenario, the above call the other method is PHP comes with, which method does not understand, you can check the PHP help document (Big God ignore)

The above describes the CI framework, the source code one-time judgment to get postget data whether there is a field value is empty method, including the post, source code aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

    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.