Attack CakePHP (Ruby On Rails framework in PHP) graphic introduction page 1/2

Source: Internet
Author: User
Tags ruby on rails

CakePHP framework home: http://www.cakephp.org/

Import the downloaded directory to the project. The directory structure is shown in figure (Version: 1.1.19.6305)

Set up the PHP environment. Here AppServ2.5.9 is used.Home http://www.appservnetwork.com/

Create a database blog in MySQL and run the following SQL statement to create a table.

/** // * 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 ());

Modify the file name of database. php. default in the app/config/directory of the project to database. php, and modify its configuration.

Modify the httpd. conf file of Apache.

Apache2.2 directly# LoadModule rewrite_modulemodules/mod_rewrite.so.

In versions earlier than 2.0, it is said that two places should be modified:LoadModule rewrite_module libexec/httpd/mod_rewrite.soAndAddModule mod_rewrite.c

Add Model:

/App/models/post. php

Code:

<? Php

Require_once ('cake/app_model.php ');

Class Post extends AppModel {

Public $ name = 'post ';

Public $ validate = array (

'Title' => VALID_NOT_EMPTY,
'Body' => VALID_NOT_EMPTY

);
}

?>

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.