Introduction to PHP Yii Open source Framework (i)

Source: Internet
Author: User

Here are some of the things you write about the YII framework training for members.

1) Download Yii 1.1.12:http://yii.googlecode.com/files/yii-1.1.12.b600af.tar.gz

2 extract to/var/www/html, and rename the directory to Yii;

3 Access to http://127.0.0.1/yii/requirements/index.php, check the computer environment to meet the requirements of yii, do not comply with the installation of the missing software; if the display of PHP PDO is unsuccessful, Please check that the PHP.ini configuration item is consistent with 1.9;

4 to facilitate viewing the example program in the YII framework, you can add the SQLite database support in the PHP configuration file, and restart Apache for effective:

Extension=php_pdo_sqlite.dll

5 Open Yii's own program and website to study its structure and procedures:

http://127.0.0.1/yii/demos/helloworld/

http://127.0.0.1/yii/demos/blog/

Wait a minute

6 Use the Yii tool to generate a template Web site:

Open command line tool: Start-> Run, command as follows:

C:\users\bihhe>d:

D:\>cd/var/www/html/yii/framework

d:\var\www\html\yii\framework>/var/php53/php/var/www/html/yii/framework/yiic.php

You can access the Web site you created by opening the browser input http://127.0.0.1/test1/index.php.

7 CREATE DATABASE tables:

CREATE TABLE ' test1 '. ' Test1_userinfo ' (

' ID ' INTEGER UNSIGNED not nullauto_increment,

' uname ' VARCHAR not NULL,

' UPass ' VARCHAR not NULL,

' Count ' INTEGER UNSIGNED,

PRIMARY KEY (' id ')

)

ENGINE = InnoDB;

8 Modify the database connection mode of the template website, modify test1/protected/config/main.php as follows:

/*

' DB ' =>array (

' connectionString ' => ' SQLite: '. DirName (__file__). ' /.. /data/testdrive.db ',

),

*/

Uncomment the following to use AMYSQL database

' DB ' =>array (

' connectionString ' => ' mysql:host=127.0.0.1;dbname=test1 ',

' Emulateprepare ' => true,

' username ' => ' root ',

' Password ' => ' password ',

' CharSet ' => ' UTF8 ',

' Tableprefix ' => ' test1_ ',

),

Once we're done, we can use Yii::app ()->db to invoke the database connection anywhere.

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.