20.01.2015 Views

Yii Framework

Yii Framework

Yii Framework

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

34<br />

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

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

models/Document.php<br />

2. Generate Crud Document<br />

หลังจากที่ได้สร้าง Model Document แล้ว จะท าการสร้าง Controller และ View โดยใช้<br />

Crud Generator เพื่อสร้างรูปแบบการเพิ่ม ลบ แก้ไขข้อมูล โดยการ Generate มีวิธีการ ดังรูปที่ 9-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!