Home > PHP Framework > ThinkPHP > body text

A brief analysis of the differences and usage scenarios between I() and create() methods in ThinkPHP

藏色散人
Release: 2021-12-30 17:40:52
forward
2369 people have browsed it

The following thinkphp framework tutorial column will give you a brief analysis of the differences and usage scenarios of the I() and create() methods in ThinkPHP. I hope it will be helpful to friends in need!

A brief analysis of the differences and usage scenarios between I() and create() methods in ThinkPHP

What is the difference between the I() method receiving data and the create() method receiving data in ThinkPHP?

Difference:

  • The I() method will automatically filter html entities;

  • ## The #create method needs to manually call the filter method of the model after automatic creation. Create includes automatic creation of data objects, automatic verification, automatic completion, and field mapping.

Which one is generally used more frequently?

  • When the number of accepted fields is small and those automatic functions are not needed, use the

    I() function;

  • Accepts a large number of fields, uses the

    create() method, and can complete many functions when creating data, which is convenient and fast.

Recommended study: "

The latest 10 thinkphp video tutorials"

The above is the detailed content of A brief analysis of the differences and usage scenarios between I() and create() methods in ThinkPHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template