YII-Note2

来源:互联网 发布:linux 解压缩 编辑:程序博客网 时间:2024/04/29 08:24

CREATETABLE Employee (
    id MEDIUMINT UNSIGNED NOTNULL AUTO_INCREMENT PRIMARYKEY,
    departmentId TINYINT UNSIGNED NOTNULL
        COMMENT"CONSTRAINT FOREIGN KEY (departmentId) REFERENCES Department(id)",
    firstNameVARCHAR(20)NOTNULL,
    lastNameVARCHAR(40)NOTNULL,
    emailVARCHAR(60)NOTNULL,
    extSMALLINTUNSIGNED NULL,
    hireDateTIMESTAMPNOT NULL DEFAULT CURRENT_TIMESTAMP,
    leaveDate DATETIME NULL,
    INDEXname (lastName, firstName),
    INDEX(departmentId)
)

use Gii to create the fundamental Model, View, and Controller files required by the application

Next, under the modules section of the returned array, you should enable Gii. Gii is a Web-based tool that you’ll use to generate Models, Views, and Controllers for the application. To enable Gii, just remove the comment tags—/* and */—that surround this code:

'gii'=>array(    'class'=>'system.gii.GiiModule',    'password'=>'SECURE',),
  • Because Gii is a powerful tool, it’s best not to enable it on a live server. Ideally you’ll enable Gii on a development server, use it, and disable it, and then later put the site online.


the Gii tool is at www.example.com/index.php/gii/.







0 0
原创粉丝点击