Initial commit

This commit is contained in:
net909
2023-09-28 16:21:06 +08:00
parent 498772eb04
commit ba7be004c0
640 changed files with 87745 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
declare (strict_types=1);
namespace app\service;
use think\facade\Validate;
class ValidateService extends \think\Service
{
/**
* 注册服务
*
* @return mixed
*/
public function register()
{
//
}
/**
* 执行服务
*
* @return mixed
*/
public function boot()
{
//
Validate::maker(function ($validate) {
$validate->extend('is_json', function ($value) {
if (!is_string($value)) {
$value = json_encode($value);
}
json_decode($value);
return json_last_error() == JSON_ERROR_NONE;
});
$validate->extend('is_legal_plugin_class', function ($value) {
if (!is_string($value)){
return false;
}
$arr = explode('\\', $value);
return count($arr) === 2;
});
});
}
}