20.01.2015 Views

Yii Framework

Yii Framework

Yii Framework

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

44<br />

รูปที่ 11-1 แสดงการ Generate Model Datetime<br />

4. เมื่อ Generate แล้วสามารถดูโค้ดได้ที่ไดเรคทอรี่ www/<strong>Yii</strong>Training/protected/<br />

models/Datetime.php<br />

2. Generate Crud Datetimes<br />

หลังจากที่ได้สร้าง Model UserDetail เป็นที่เรียบร้อยแล้ว จะท าการสร้าง Controller และ<br />

View โดยใช้ Crud Generator เพื่อสร้างรูปแบบการเพิ่ม ลบ แก้ไขข้อมูล โดยการ Generate มีวิธีการ<br />

ดังรูปที่ 11-2<br />

1. ที่ http://localhost/<strong>Yii</strong>Training/index.php/gii เลือก Crud Generator ใส่ชื่อ<br />

Model และ Controller<br />

2. คลิกที่ Preview หลังจากนั้นจะแสดง File ซึ่งสามารถแสดงรูปแบบ Source<br />

Code ได้<br />

3. คลิกที่ Generate เพื่อสร้าง Code File

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!