This commit is contained in:
2020-03-25 17:08:02 +08:00
parent 6b9202d341
commit 0d2ef31222
35 changed files with 1212 additions and 130 deletions

33
app/http/form/Form.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\http\form;
use think\facade\View;
/**
* @title 后台中间件
*/
class Form {
public static function render($field, $data){
if (in_array($field['type'], ['string', 'text'])) {
$field['type'] = 'text';
}
$class = "app\\http\\form\\factory\\" . ucfirst($field['type']);
if (class_exists($class)) {
$elem = new $class($field, $data);
}else{
$elem = new \app\http\form\Factory($field, $data);
}
return $elem->show();
}
}