softcontroller.php
来自「a short sketch about linux syntex lines.」· PHP 代码 · 共 38 行
PHP
38 行
<?php
class SoftController extends Easy_Controller_Action {
public function Init(){
$this->_Soft = new SoftModel();
}
public function IndexAction(){
$this->_View->soft = $this->_Soft->getAll();
}
public function addAction(){
if ($this->_Request->isPost()){
if ($this->_Soft->add($this->_Request->getPost()) ===false){
$this->_View->message = $this->_Soft->error;
}else{
$this->_View->message = _('添加成功!');
}
exit($this->_View->Render('message'));
}
}
public function modifyAction(){
if ($this->_Request->isPost()){
if ($this->_Soft->modify($this->_Request->getPost())===false){
$this->_View->message = $this->_Soft->error;
}else{
$this->_View->message = _('修改成功!');
}
exit($this->_View->Render('message'));
}else{
$this->_View->modify = $this->_Soft->getRow((int)$this->_Request->getParam('id'));
}
}
public function deleteAction(){
$this->_Soft->delete($this->_Request->getParam('id'));
$this->_View->message = _('删除成功!');
exit($this->_View->Render('message'));
}
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?