Cracking CakePHP (RubyOnRails framework in PHP) graphic introduction page 1/2 _ PHP Tutorial

Source: Internet
Author: User
The graphic introduction to CakePHP (RubyOnRails framework in PHP) page 1. CakePHP framework home page: www.cakephp.org download and import to the project. the directory structure is as follows (use version: 1.1.19.6305) to build the PHP environment. here AppServ2.5.9 is used. Download 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');

ClassPostExtendsAppModel {

Public $ Name = 'Post';

Public $ Validate = Array(

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

);
}

?>

Idea http://www.cakephp.org/after the download import project, directory structure such as (using version: 1.1.19.6305) to build the PHP environment, here using 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.