CakePHP学习之二 简单的测试例子
1.首先建立自己的表
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.', '2009-06-16 10:04:05', null);
INSERT INTO `posts` VALUES ('2', 'A title once again', 'And the post body follows.', '2009-06-16 10:04:05', null);
INSERT INTO `posts` VALUES ('3', 'Title strikes back', 'This is really exciting! Not.', '2009-06-16 10:04:05', null);
INSERT INTO `posts` VALUES ('4', '3232', '33', '2009-06-16 06:03:06', '2009-06-16 06:03:06');
2.在models里添加post.php文件
<?php
class Post extends AppModel{
    var $name = 'Post';
}
?> 
3.在controllers目录下添加 posts_Controller.php
<?php
class PostsController extends AppController{
   var $name = 'Posts';
  var $scaffold;
 }
?> 
4.在ie里输入http://127.0.0.1:8081/posts
你可以看到下面的效果
 
 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号