Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the differences between the I () and create () methods in ThinkPHP

Shulou Source: shulou.com Published: 2022-06-02 05:09:00 10月25日 Update

This article mainly introduces the difference between I() and create() methods in ThinkPHP, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.

What's the difference between I() and create() in ThinkPHP?

Difference:

The I() method automatically filters 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 validation, automatic completion, and field mapping.

Which one is used more frequently in general?

When the number of fields accepted is small, use the I() function when those automatic functions are not needed;

Accept a large number of fields, use the create() method, and when the data is created, you can complete many functions, which is convenient and fast.

Thank you for reading this article carefully. I hope that Xiaobian's "What is the difference between I() and create() methods in ThinkPHP" will help everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Tags: Method data article field time function quantity convenience value interest function at the same time afterhand entity object situation more friends knowledge tape Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Tech Info MariaDB Shulou Information MySQL