Conquer CakePHP (Ruby on Rails Framework in PHP) Introduction to 1th/2 page _php Tutorial

Source: Internet
Author: User
Tags name database ruby on rails
CakePHP Framework Home: http://www.cakephp.org/

After downloading the project, the directory structure such as (using version: 1.1.19.6305)

Build a PHP environment where AppServ2.5.9 is used. Download Home http://www.appservnetwork.com/

Create a new database blog in MySQL and run the following SQL Wen Jianqu.

/**/ / * First , create our posts table: * /
CREATE TABLE Posts (
ID INT UNSIGNED auto_increment PRIMARY KEY ,
Title VARCHAR ( - ),
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 ());

Modify the Project app/config/directory under Database.php.default file name database.php, and modify its configuration.

Modify the Apache httpd.conf file.

Apache2.2 version, directly delete the comments #LoadModule rewrite_modulemodules/mod_rewrite.so .

2.0 Previous versions, it is said to modify 2 places: LoadModule rewrite_module libexec/httpd/mod_rewrite.so and addmodule mod_rewrite.c

Add Model:

/app/models/post.php

Code:

PHP

require_once ('cake/app_model.php');

classPostextendsAppmodel {

Public $name = 'Post';

Public $validate = Array(

'title' =Valid_not_empty,
'Body' =Valid_not_empty

);
}

?>

http://www.bkjia.com/PHPjc/319633.html www.bkjia.com true http://www.bkjia.com/PHPjc/319633.html techarticle cakephp Framework homepage: http://www.cakephp.org/After downloading the project, the directory structure such as (using version: 1.1.19.6305) to build PHP environment, where the use of AppServ2.5.9. Download ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.