Home >Backend Development >PHP Tutorial >Things to note when processing forms in ThinkPHP, thinkphp form_PHP tutorial

Things to note when processing forms in ThinkPHP, thinkphp form_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:13:231156browse

Things to note when processing forms in ThinkPHP, thinkphp forms

The examples in this article describe the precautions when processing forms in ThinkPHP. Share it with everyone for your reference. The specific analysis is as follows:

In the form submission data in ThinkPHP, there are the following issues that need to be paid attention to:

1. Accessing a method in the module directly through URL is very unsafe. You can use the following to limit

Copy code The code is as follows:
$this->isPost(); // Determine whether the method is accessed in post mode.

Use the constant IS_POST to determine in 3.1.3.

2. How to handle errors:

_404('Prompt error','Jump [note that it will not jump when debugging mode is turned on]','');

Method halt();

Query:

Copy code The code is as follows:
M('wish')->select();

Add:

Copy code The code is as follows:
M('wish')->data($data)->add( [$data]);

Delete:

Copy code The code is as follows:
[Must have where condition]M('wish')->where()- >delete();

data() instantiation parameters:

Copy code The code is as follows:
M('wish')->data($data) ->add();

Assign in template

I hope this article will be helpful to everyone’s ThinkPHP framework programming.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/916058.htmlTechArticleThings to note when processing forms in ThinkPHP, thinkphp form This article describes the precautions when processing forms in ThinkPHP. Share it with everyone for your reference. The specific analysis is as follows: T...
Statement:
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