Here are some of the things that are written to members for YII framework training. 1) Download Yii 1.1.12:2) to/var/www/html, and rename the directory to yii;3) check whether the computer environment meets YII requirements, do not meet the installation of the missing software, if the display PHP PDO is unsuccessful, Check that the PHP.ini configuration item is the same as 1.9, 4) for easy viewing of the example program in the YII framework, you can add the SQLite database support in the PHP configuration file, restart Apache to take effect: EXTENSION=PHP_PDO_SQLITE.DLL5) Open Yii's own program and website, study its structure and program: http://127.0.0.1/yii/demos/helloworld/http://127.0.0.1/yii/demos/blog/et cetera 6) Use the Yii tool to generate a template Web site: Open command-line tools: Start-and-run, commands as follows: c:\users\bihhe>d:d:\>cd/var/www/html/yii/frameworkd:\var\www\html \yii\framework>/var/php53/php/var/www/html/yii/framework/yiic.php webapp/var/www/html/test1 Open Browser input/HTTP// 127.0.0.1/test1/index.php can access the created Web site. 7) Create DATABASE table: "CREATE table ' test1 '. ' Test1_userinfo ' (' id ' INTEGER UNSIGNED not NULL auto_increment, ' uname ' VARCHAR" not N ULL, ' UPass ' VARCHAR (not NULL, ' count ' INTEGER UNSIGNED, PRIMARY KEY (' id ')) ENGINE = innodb;8) Modify the database connection mode of the template site, modify the test1/ protected/config/main.php as follows:/* ' DB ' =>array (' connectionString ' = ' sqlite: '. DirName (__file__). ' /.. /data/testdrive.db ',), *//uncomment the following to use a MYsql database ' db ' =>array (' connectionString ' = ' mysql:host=127.0.0.1;dbname=test1 ', ' emulateprepare ' = True, ' username ' = ' root ', ' password ' = ' password ', ' charset ' = ' utf8 ', ' tableprefix ' = ' test1_ ', ' and when well, we'll The database connection can be invoked anywhere using Yii::app ()->db. 9) Use the GII tool to generate model and crud (additions and deletions): Edit protected/config/main.php as follows: Return Array (...) ' Import ' =>array (' application.models.* ', ' application.components.* ', '), ' modules ' =>array (' gii ' =>array (' Class ' = ' system.gii.GiiModule ', ' password ' = ' pick up a password here ',),); Open Web page: http://127.0.0.1/index.php?r =gii input Password Enter, select Generate model, input table name: Test1_userinfo, Model class name: Tuserinfo; Click Generate, the model class will generate in: Test1\protected\models the same way to choose to generate CRUD , code generation in: Test1\protected\controllerstest1\protected\views\tuserinfo research test1\protected\controllers\ Tuserinfocontroller.php and other generated Web page input URLs to access the Web page you just generated: Http://127.0.0.1/test1/index.php?r=tuserinfo Add Module: Open Web page:/http 127.0.0.1/index.php?r=gii input Password Enter, select Generate module, enter userinfo module name, click Generate; page generated in: Test1\protected\modules\userinfo edit main.php as follows: ' Modules ' =>array (//Uncomment the following to enable the GII tool ' GII ' =>array (' class ' = ' System ') . gii. Giimodule ', ' password ' = ' Nokialab ',//If removed, Gii defaults to localhost only. Edit carefully to taste. ' Ipfilters ' =>array (' 127.0.0.1 ', ':: 1 '), ' UserInfo ',), enter the URL http://127.0.0.1/test1/index.php?r=UserInfo/ Default/index can access the newly generated module. 10) Import the project in Eclipse: Make sure that the Eclipse version is Helios for PHP, creating the. project file under the project root, with the content: webprojectname org.eclipse.wst.validation.validationbuilder Org.eclipse.dltk.core.scriptbuilder org.eclipse.php.core.PHPNature Create the. buildpath file under the project root directory with the following content: www.2cto.com Open Eclipse,fileàimportàexisting project into workspaceànextàselect root directory, select the project directory, and continue. One) yii page includes view, layout if there is Chinese, please save the page format to Utf-8, otherwise the Chinese display will be garbled;
http://www.bkjia.com/PHPjc/477809.html www.bkjia.com true http://www.bkjia.com/PHPjc/477809.html techarticle Here are some of the things that are written to members for YII framework training. 1) Download Yii 1.1.12:2) to/var/www/html and rename the directory to Yii; 3) Check whether the computer environment meets YII requirements ...