Provides various official and user-released code examples. For code reference, you are welcome to learn how to automatically verify why "Invalid Data Objects!" appears !"
Namespace Home \ Controller;
Use Think \ Controller;
Class IndexController extends Controller {
Public function index (){
$ User = D ("title ");
// Instantiate the User object
If (! $ User-> create ()){
// Create a Data Object
// If creation fails, the verification fails and an error message is displayed.
Exit ($ User-> getError ());
} Else {
// Verify that new data is written
$ User-> add ();
}
// $ This-> display ();
}
}
MODEL:
Namespace Home \ Model;
Use Think \ Model;
Class TitleModel extends Model {
Protected $ _ validate =
Array (
Array ('title', 'require ', 'verification code is required! '),
);
}
View:
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB