function test() { $me = createModel('Me'); if ($_POST) { if (!$me->checkForm($_POST, 'add', $error)) { Swoole\JS::js_back($error); return; } echo 'ok'; } else { $form = $me->getForm(); $this->swoole->tpl->assign('head', Swoole\Form::head('me_add', 'post', '', true)); $this->swoole->tpl->assign('js', Swoole\Form::js('me_add')); $this->swoole->tpl->assign('form', $form); $this->swoole->tpl->display('test.html'); } }