Considerations in Handling Forms in ThinkPHP
- 2021-08-05 09:23:34
- OfStack
This article illustrates the considerations in dealing with forms in ThinkPHP. Share it for your reference. The specific analysis is as follows:
In the form submission data in ThinkPHP, there are the following issues that need attention:
1. It is very unsafe to access one method in the module directly through url. You can use the following to limit
$this->isPost();// Judge whether it is based on post Method to access methods.
In 3.1. 3, the constant IS_POST is used to judge.
2. How to handle errors:
_ 404 ('Prompt for error', 'Jump' Note no jump when debug mode is turned on ',');
Method halt ();
Inquiry:
M('wish')->select();
Add:
M('wish')->data($data)->add([$data]);
Delete:
[1 Be sure where Condition ]M('wish')->where()->delete();
data () instantiation parameter:
M('wish')->data($data)->add();
Assign in a template
I hope this article is helpful to everyone's ThinkPHP framework programming.