This is the front desk
This is the Cate controller
##This is the Model template
The problem is that the data can be inserted into the database normally, but it cannot be verified whether it is empty? Please help me find out why?
怪我咯2017-05-27 17:45:50
Is the code in the Cate controller written wrong? . .
$data['catename'] = I('catename'); Is this line wrong?
It should be:
$data['catename'] = I('post.catename');
Let’s do this.
In fact, you don’t need to write it again to get it. The direct create method will get all the data requested by the front desk
Another thing to note is that the create method only accepts post request data by default when you have not modified the underlying code
某草草2017-05-27 17:45:50
I mean, to refute the above, there is no problem with I ("catename"). I forgot the form verification, but you can try the following test
1. Use a custom verification function. You can see whether verification is called (see how the document defines it)
2. Verify the length, because the value obtained by the I() function is not null
but an empty string
.