參考:Tutorial: Getting Started with Zend Framework 1.10
針對IndexController建立CRUD action
URL | Action method |
---|---|
http://localhost/public/ | IndexController::indexAction() |
http://localhost/add / | IndexController::addAction() |
http://localhost/edit / | IndexController::editAction() |
http://localhost/delete / | IndexController::deleteAction() |
- %zf create action add Index
- %zf create action edit Index
- %zf create action delete Index
所以說如果是要針對UserController,最後的Index就改成User以下是IndexController的內容
//controllers/IndexController.php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
}
public function addAction()
{
// action body
}
public function editAction()
{
// action body
}
public function deleteAction()
{
// action body
}
}
沒有留言:
張貼留言