Upload
quynguyen
View
214
Download
0
Embed Size (px)
DESCRIPTION
Yii 1
Citation preview
Cài đặt- Bước 1:
Mở Control Panel → System and Security → System → Advanced system settings (cách khác: nhấp chuột phải vào biểu tượng Computer trên Desktop chọn Properties → Advanced system settings)
Cửa sổ System Properties hiện ra → Click vào ô Environment VariablesCửa sổ Environment Variables hiện ra → ở ô System variables tìm Path và nhấn Edit
Cửa sổ Edit system variable xuất hiện → thêm ;C:\xampp\php vào ô Variable value
- Bước 2:
cd webrootphp yii/framework/yiic webapp appnameorphp.exe yii/framework/yiic webapp firstapporphp.exe yii/framework/yiic.php webapp firstapp
- BƯớc 3:http://localhost/firstapp/index.php
Sử dụng gii1 Kích hoạt Gii tool – trình tự tạo code của Yii
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'12345',
// If removed, Gii defaults to localhost only. Edit
carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),),
2 Kích hoạt URL thân thiện hơn3 Kết nối database4 Sử dụng gii tạo code
Theo đường link http://localhost/firstapp/index.php/gii để vào trang Yii Code Ganerator (Gii) và nhập password là ‘12345’
Vào trang Model Generator → điền member vào Table Name → click Preview → clickGenerate
Chúng ta đã tạo xong một file Member.php trong
firstapp/protected/models/Member.php
Tiếp theo vào trang Crud Generator → điền Member vào Model Class → click Preview → click Generate