搭建PHP环境,这里使用了AppServ2.5.9。 下载主页 http://www.appservnetwork.com/
MySQL中新建数据库blog/并运行如下SQL">
Home > Article > Backend Development > Overcoming the Ruby On Rails Framework in CakePHPPHP Graphical Introduction Page 1/2
CakePHP框架首页: http://www.cakephp.org/
下载后导入工程中,目录结构如下图(使用版本:1.1.19.6305)
搭建PHP环境,这里使用了AppServ2.5.9。 下载主页 http://www.appservnetwork.com/
MySQL中新建数据库blog,并运行如下SQL文建表。
/**//* First, create our posts table: */
CREATE TABLE posts (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(50),
body TEXT,
created DATETIME DEFAULT NULL,
modified DATETIME DEFAULT NULL
);
/**//* Then insert some posts for testing: */
INSERT INTO posts (title,body,created)
VALUES ('The title', 'This is the post body.', NOW());
INSERT INTO posts (title,body,created)
VALUES ('A title once again', 'And the post body follows.', NOW());
INSERT INTO posts (title,body,created)
VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());
修改工程app/config/目录下database.php.default文件名为database.php,并修改其配置。
修改Apache的httpd.conf文件。
Apache2.2版本的,直接把#LoadModule rewrite_modulemodules/mod_rewrite.so的注释删掉即可。
2.0以前的版本,据说要修改2个地方: LoadModule rewrite_module libexec/httpd/mod_rewrite.so 和AddModule mod_rewrite.c
增加Model:
/app/models/post.php
代码:
php
require_once ('cake/app_model.php');
class Post extends AppModel
;
public$validate =array(
) ID_NOT_EMPTY
, 'body' => VALID_NOT_EMPTY
);}?>Current 1 /2 pages 12 next page
The above has introduced page 1/2 of the graphic introduction to the Ruby On Rails framework in CakePHP HP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.