1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- // +----------------------------------------------------------------------
- // | Yzncms [ 御宅男工作室 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2018 http://yzncms.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: 御宅男 <530765310@qq.com>
- // +----------------------------------------------------------------------
-
- // +----------------------------------------------------------------------
- // | 字段模型
- // +----------------------------------------------------------------------
- namespace app\cms\model;
-
- use think\Model;
-
- /**
- * 字段模型
- */
- class ModelField extends Model
- {
- protected $autoWriteTimestamp = true;
-
- public function getExtendHtmlAttr($value, $data)
- {
- $result = preg_replace_callback("/\{([a-zA-Z]+)\}/", function ($matches) use ($data) {
- if (isset($data[$matches[1]])) {
- return $data[$matches[1]];
- }
- }, $data['extend']);
- return $result;
- }
- }
|