Swoole\Form::head PHP 메소드

head() 정적인 공개 메소드

表单头部
static public head ( $form_name, $method = 'post', $action = '', $if_upload = false, $attrArray = null ) : string
$form_name
$method
$action
$if_upload
$attrArray
리턴 string
    static function head($form_name, $method = 'post', $action = '', $if_upload = false, $attrArray = null)
    {
        if ($if_upload) {
            $attrArray['enctype'] = "multipart/form-data";
        }
        $attrStr = self::input_attr($attrArray);
        return "action='{$action}' method='{$method}' name='{$form_name}' id='{$form_name}' {$attrStr}";
    }

Usage Example

예제 #1
0
 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');
     }
 }