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.
http://www.bkjia.com/PHPjc/916058.htmlwww.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...