1. First create your own table
Set foreign_key_checks = 0;
------------------------------
-- Table structure for posts
------------------------------
Create Table 'posts '(
'Id' int (10) unsigned not null auto_increment,
'Title' varchar (50) default null,
'Body' text,
'Created 'datetime default null,
'Modified' datetime default null,
Primary Key ('id ')
) Engine = InnoDB default charset = GBK;
------------------------------
-- Records
------------------------------
Insert into 'posts' values ('1', 'the title', 'This is the post body. ', '2017-06-16 10:04:05', null );
Insert into 'posts' values ('2', 'a title once again ',' and the post body follows. ', '2017-06-16 10:04:05', null );
Insert into 'posts' values ('3', 'title strikes back', 'This is really exciting! Not. ', '2017-06-16 10:04:05', null );
Insert into 'posts' values ('4', '000000', '33', '2017-06-16 06:03:06 ', '2017-06-16 06:03:06 ');
2. Add the post. php file in models.
<? PHP
Class Post extends appmodel {
VaR $ name = 'post ';
}
?>
3. Add posts_controller.php under the controllers directory
<? PHP
Class postscontroller extends appcontroller {
VaR $ name = 'posts ';
VaR $ scaffold;
}
?>
4. Enter http: // 127.0.0.1: 8081/posts in IE
You can see the following results