The following content is written for the Yii Framework training for members. 1) Download Yii1.1.12: 2) decompress the package to/var/www/html and rename the directory to yii; 3) Check whether the computer environment meets the yii requirements. if not, install the software you lack; if phpp is displayed... "/> SyntaxHighligh: Below are some content written for Yii Framework training for members. 1) Download Yii 1.1.12: 2) decompress it to/var/www/html and rename the directory to yii; 3) Check whether the computer environment meets yii requirements, install the missing software if it does not comply with the requirements. if it is displayed that php pdo is not successful, check php. check whether the ini configuration item is consistent with that in 1.9. 4) to facilitate viewing the example program in the Yii Framework, add the sqlite database support in the php configuration file and restart Apache to take effect: extension = php_pdo_sqlite.dll5) open the program and website that comes with Yii and study its structure and program: http://127.0.0.1/yii/demos/helloworld/http://127.0.0.1/yii/demos/blog/ (6) use the Yii tool to generate a template website: Open the command line tool: Start-> Run. the command is 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 the browser and enter http://127.0.0.1/test1/index.php You can access the created website. 7) CREATE a database TABLE: create table 'test1 '. 'test1 _ userinfo' ('id' integer unsigned not null AUTO_INCREMENT, 'uname' VARCHAR (45) not null, 'upass' VARCHAR (45) not null, 'Count' integer unsigned, primary key ('id') ENGINE = InnoDB; 8) modify the database connection method of the template website, and modify test1/protected/config/main. php is as follows:/* 'DB' => array ('ononstring' => 'sqlite :'. dirname (_ FILE __). '/.. /data/testdrive. db',), * // uncomment the following Use a MySQL database 'DB' => array ('ononstring' => 'MySQL: host = 127.0.0.1; dbname = test1', 'emulateprepare' => true, 'username' => 'root', 'password' => 'password', 'charset' => 'utf8', 'tableprefix' => 'test1 _',), after configuration, we can use Yii: app ()-> db to call the database connection anywhere. 9) use the Gii tool to generate Model and CRUD (add, delete, query, modify): Edit protected/config/main. php is as follows: return array (...... 'import' => array ('application. models. * ', 'application. components. * ',), 'modules' => array ('giii' => array ('class' => 'system. gii. giiModule ', 'password' => 'pick up a password here',); open the webpage: http://127.0.0.1/index.php?r=gii Enter the password and select generate model. input table name: test10000userinfo and Model class name: TUserInfo. Click Generate. The Model class is generated in: test1 \ protected \ models select to generate CRUD in the same way. The code is generated in: test1 \ protected \ controllerstest1 \ protected \ views \ tUserInfo to study test1 \ protected \ controllers \ TUserInfoController. php and other generated web pages can be accessed by entering the Web site: http://127.0.0.1/test1/index.php ? R = tuserinfo add Module: open webpage: http://127.0.0.1/index.php?r=gii Enter the password, select generate module, enter the UserInfo module name, and Click Generate. The webpage is generated at: test1 \ protected \ modules \ UserInfo to edit main. php is 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 ('123. 0.0.1 ',': 1'),), 'userinfo',), and enter the URL http://127.0.0.1/test1/index.php ? R = UserInfo/default/index to access the newly generated module. 10) import a project to Eclipse: make sure that the eclipse version is helios for php and the. project file is created under the project root directory. the content is: Webprojectname Org. eclipse. wst. validation. validationbuilder Org. eclipse. dltk. core. scriptbuilder Org. eclipse. php. core. PHPNature Create the. buildpath file in the root directory of the project. the content is as follows: Www.2cto.com Open eclipse, File à Import à Existing Project into Workspace à Next à Select root directory, Select the Project directory, and continue. 11) if the Yii page includes view and layout has Chinese characters, change the format of saving the page to UTF-8; otherwise, Chinese characters will be garbled;
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.