本文实例讲述了基于CakePHP实现的简单博客系统。分享给大家供大家参考。具体实现方法如下:
PostsController.php文件:
Post.php文件:
routes.php文件:
blog.sql文件如下:
-- Table structure for table
posts
DROP TABLE IF EXISTS posts
;
/!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 /;
CREATE TABLE posts
(
id
int(10) unsigned NOT NULL AUTO_INCREMENT,title
varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,body
text COLLATE utf8_unicode_ci,created
datetime DEFAULT NULL,modified
datetime DEFAULT NULL,PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/!40101 SET character_set_client = @saved_cs_client /;
-- Dumping data for table posts
LOCK TABLES posts
WRITE;
/!40000 ALTER TABLE posts
DISABLE KEYS /;
INSERT INTO posts
VALUES (1,'The title','This is the post body.','2012-11-01 15:43:41',NULL),(2,'A title once again','And the post body follows.',(3,'Title strikes back','This is really exciting! Not.',(4,'ggjjkhkhhk','7777777777777777777777777\r\n777777777777777777777777','2012-11-01 20:16:28','2012-11-01 20:16:28');
/!40000 ALTER TABLE posts
ENABLE KEYS /;
UNLOCK TABLES;
-- Table structure for table schema_migrations
DROP TABLE IF EXISTS schema_migrations
;
/!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 /;
CREATE TABLE schema_migrations
(
version
varchar(255) COLLATE utf8_unicode_ci NOT NULL,UNIQUE KEY unique_schema_migrations
(version
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/!40101 SET character_set_client = @saved_cs_client /;
-- Dumping data for table schema_migrations
LOCK TABLES schema_migrations
WRITE;
/!40000 ALTER TABLE schema_migrations
DISABLE KEYS /;
INSERT INTO schema_migrations
VALUES ('20121013024711'),('20121013030850');
/!40000 ALTER TABLE schema_migrations
ENABLE KEYS /;
UNLOCK TABLES;
/!40103 SET TIME_ZONE=@OLD_TIME_ZONE /;
/!40101 SET SQL_MODE=@OLD_SQL_MODE /;
/!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS /;
/!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS /;
/!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /;
/!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /;
/!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION /;
/!40111 SET SQL_NOTES=@OLD_SQL_NOTES /;
-- Dump completed on 2012-11-01 16:41:46
希望本文所述对大家的php程序设计有所帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。