/** * 编辑字段 * @return */ public function edit() { if (!isset($_GET['model_id']) || !isset($_GET['field_id']) || !D('Model', 'Service')->existModel($_GET['model_id']) || !D('Field', 'Service')->existField($_GET['field_id'])) { return $this->error('您需要编辑的字段不存在!'); } $model = M('Model')->getById($_GET['model_id']); $field = D('Field')->relation(true)->getById($_GET['field_id']); $input = $field['input']; $models = D('Model', 'Service')->getAll(); $filters = get_registry_filter(); $fills = get_registry_fill(); D('Field', 'Logic')->resetLength($field); $this->assign('models', $models); $this->assign('model', $model); $this->assign('field', $field); $this->assign('input', $input); $this->assign('filters', $filters); $this->assign('fills', $fills); $this->display(); }
*/ function uuid($prefix = '') { $str = md5(uniqid(mt_rand(), true)); $uuid = substr($str, 0, 8) . '-'; $uuid .= substr($str, 8, 4) . '-'; $uuid .= substr($str, 12, 4) . '-'; $uuid .= substr($str, 16, 4) . '-'; $uuid .= substr($str, 20, 12); return $prefix . $uuid; } /** * 生成datetime * @return string */ function datetime() { return date('Y-m-d H:i:s'); } // 得到已经注册的已定义函数 $customFill = get_registry_fill(); if (!isset($customFill) || !is_array($customFill)) { $customFill = array(); } $fill = array('uuid', 'datetime'); foreach ($fill as $item) { if (!in_array($item, $customFill)) { $customFill[] = $item; } } fast_cache(FILL_NAME, $customFill, FUNC_CONF_DIR_PATH);