mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
Merge branch 'master' of https://github.com/top-think/think
This commit is contained in:
@@ -47,7 +47,7 @@ class Tencent extends Driver
|
||||
'oauth_consumer_key' => $this->AppKey,
|
||||
'access_token' => $this->token['access_token'],
|
||||
'openid' => $this->openid(),
|
||||
'clientip' => get_client_ip(),
|
||||
'clientip' => $_SERVER['REMOTE_ADDR'],
|
||||
'oauth_version' => '2.a',
|
||||
'scope' => 'all',
|
||||
'format' => 'json',
|
||||
|
||||
@@ -23,21 +23,21 @@ class App
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public static function run(array $config = [])
|
||||
public static function run()
|
||||
{
|
||||
// 初始化公共模块
|
||||
self::initModule(COMMON_MODULE, $config);
|
||||
|
||||
// 获取配置参数
|
||||
$config = Config::get();
|
||||
self::initModule(COMMON_MODULE, Config::get());
|
||||
|
||||
// 读取扩展配置文件
|
||||
if ($config['extra_config_list']) {
|
||||
foreach ($config['extra_config_list'] as $file) {
|
||||
if (Config::get('extra_config_list')) {
|
||||
foreach (Config::get('extra_config_list') as $file) {
|
||||
Config::load($file, $file);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取配置参数
|
||||
$config = Config::get();
|
||||
|
||||
// 日志初始化
|
||||
Log::init($config['log']);
|
||||
// 缓存初始化
|
||||
@@ -110,12 +110,8 @@ class App
|
||||
}
|
||||
// 操作方法执行完成监听
|
||||
APP_HOOK && Hook::listen('action_end', $data);
|
||||
// 返回数据
|
||||
if (IN_UNIT_TEST) {
|
||||
return $data;
|
||||
} else {
|
||||
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
|
||||
}
|
||||
// 输出数据
|
||||
return Response::send($data, '', Config::get('response_return'));
|
||||
} else {
|
||||
// 操作方法不是Public 抛出异常
|
||||
throw new \ReflectionException();
|
||||
@@ -127,12 +123,8 @@ class App
|
||||
$data = $method->invokeArgs($instance, [$action, '']);
|
||||
// 操作方法执行完成监听
|
||||
APP_HOOK && Hook::listen('action_end', $data);
|
||||
// 返回数据
|
||||
if (IN_UNIT_TEST) {
|
||||
return $data;
|
||||
} else {
|
||||
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
|
||||
}
|
||||
// 输出数据
|
||||
return Response::send($data, '', Config::get('response_return'));
|
||||
} else {
|
||||
throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002);
|
||||
}
|
||||
@@ -251,7 +243,10 @@ class App
|
||||
|
||||
// 检测域名部署
|
||||
if (!IS_CLI && !empty($config['url_domain_deploy'])) {
|
||||
if ($match = Route::checkDomain($config['url_domain_rules'])) {
|
||||
if ($config['url_domain_rules']) {
|
||||
Route::domain($config['url_domain_rules']);
|
||||
}
|
||||
if ($match = Route::checkDomain()) {
|
||||
(!defined('BIND_MODULE') && !empty($match[0])) && define('BIND_MODULE', $match[0]);
|
||||
(!defined('BIND_CONTROLLER') && !empty($match[1])) && define('BIND_CONTROLLER', $match[1]);
|
||||
(!defined('BIND_ACTION') && !empty($match[2])) && define('BIND_ACTION', $match[2]);
|
||||
@@ -292,15 +287,15 @@ class App
|
||||
$depr = $config['pathinfo_depr'];
|
||||
// 还原劫持后真实pathinfo
|
||||
$path_info =
|
||||
(defined('BIND_MODULE') ? BIND_MODULE . $depr : '') .
|
||||
(defined('BIND_CONTROLLER') ? BIND_CONTROLLER . $depr : '') .
|
||||
(defined('BIND_ACTION') ? BIND_ACTION . $depr : '') .
|
||||
$_SERVER['PATH_INFO'];
|
||||
(defined('BIND_MODULE') ? BIND_MODULE . $depr : '') .
|
||||
(defined('BIND_CONTROLLER') ? BIND_CONTROLLER . $depr : '') .
|
||||
(defined('BIND_ACTION') ? BIND_ACTION . $depr : '') .
|
||||
$_SERVER['PATH_INFO'];
|
||||
|
||||
// 路由检测
|
||||
if (!empty($config['url_route_on'])) {
|
||||
// 开启路由 则检测路由配置
|
||||
Route::register($config['route']);
|
||||
Route::register(!empty($config['route']) ? $config['route'] : null);
|
||||
$result = Route::check($path_info, $depr);
|
||||
if (false === $result) {
|
||||
// 路由无效
|
||||
|
||||
@@ -8,15 +8,14 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace think;
|
||||
|
||||
class Create
|
||||
class Build
|
||||
{
|
||||
public static function build($build)
|
||||
public static function run($build)
|
||||
{
|
||||
// 锁定
|
||||
$lockfile = APP_PATH . 'create.lock';
|
||||
$lockfile = APP_PATH . 'build.lock';
|
||||
if (is_writable($lockfile)) {
|
||||
return;
|
||||
} else {
|
||||
4
library/think/cache/driver/apc.php
vendored
4
library/think/cache/driver/apc.php
vendored
@@ -25,7 +25,9 @@ class Apc
|
||||
'prefix' => '',
|
||||
'length' => 0,
|
||||
];
|
||||
|
||||
/*****************************
|
||||
需要支持apc_cli模式
|
||||
******************************/
|
||||
/**
|
||||
* 架构函数
|
||||
*
|
||||
|
||||
@@ -34,7 +34,7 @@ abstract class Hprose
|
||||
}
|
||||
|
||||
//导入类库
|
||||
think\Loader::import('vendor.Hprose.HproseHttpServer');
|
||||
\think\Loader::import('vendor.Hprose.HproseHttpServer');
|
||||
//实例化HproseHttpServer
|
||||
$server = new \HproseHttpServer();
|
||||
if ($this->allowMethodList) {
|
||||
|
||||
@@ -28,7 +28,7 @@ abstract class Jsonrpc
|
||||
}
|
||||
|
||||
//导入类库
|
||||
think\Loader::import('vendor.jsonrpc.jsonRPCServer');
|
||||
\think\Loader::import('vendor.jsonrpc.jsonRPCServer');
|
||||
// 启动server
|
||||
\jsonRPCServer::handle($this);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,10 @@ abstract class Rest
|
||||
protected function response($data, $type = '', $code = 200)
|
||||
{
|
||||
Response::sendHttpStatus($code);
|
||||
Response::returnData($data, strtolower($type));
|
||||
Response::data($data);
|
||||
if ($type) {
|
||||
Response::type($type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,7 +134,7 @@ abstract class Rest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ abstract class Rpc
|
||||
}
|
||||
|
||||
//导入类库
|
||||
think\Loader::import('vendor.phprpc.phprpc_server');
|
||||
\think\Loader::import('vendor.phprpc.phprpc_server');
|
||||
//实例化phprpc
|
||||
$server = new \PHPRPC_Server();
|
||||
if ($this->allowMethodList) {
|
||||
|
||||
@@ -1148,7 +1148,7 @@ abstract class Driver
|
||||
*/
|
||||
protected function debug($start)
|
||||
{
|
||||
if ($this->config['debug']) {
|
||||
if (!empty($this->config['debug'])) {
|
||||
// 开启数据库调试模式
|
||||
if ($start) {
|
||||
Debug::remark('queryStartTime', 'time');
|
||||
|
||||
@@ -61,7 +61,7 @@ class Mongo extends Driver
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public function connect($config = '', $linkNum = 0)
|
||||
public function connect($config = '', $linkNum = 0, $autoConnection = false)
|
||||
{
|
||||
if (!isset($this->linkID[$linkNum])) {
|
||||
if (empty($config)) {
|
||||
@@ -70,7 +70,7 @@ class Mongo extends Driver
|
||||
|
||||
$host = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : '') . '/' . ($config['database'] ? "{$config['database']}" : '');
|
||||
try {
|
||||
$this->linkID[$linkNum] = new \mongoClient($host, $this->config['params']);
|
||||
$this->linkID[$linkNum] = new \mongoClient($host, !empty($this->config['params'])?$this->config['params']:array());
|
||||
} catch (\MongoConnectionException $e) {
|
||||
throw new Exception($e->getmessage());
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class Mongo extends Driver
|
||||
$this->_mongo = $this->_linkID->selectDb($db);
|
||||
}
|
||||
// 当前MongoCollection对象
|
||||
if ($this->config['debug']) {
|
||||
if (!empty($this->config['debug'])) {
|
||||
$this->queryStr = $this->_dbName . '.getCollection(' . $collection . ')';
|
||||
}
|
||||
if ($this->_collectionName != $collection) {
|
||||
@@ -249,7 +249,7 @@ class Mongo extends Driver
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function insertAll($dataList, $options = [])
|
||||
public function insertAll($dataList, $options = [], $replace = false)
|
||||
{
|
||||
if (isset($options['table'])) {
|
||||
$this->switchCollection($options['table']);
|
||||
@@ -483,9 +483,9 @@ class Mongo extends Driver
|
||||
}
|
||||
$this->model = $options['model'];
|
||||
$this->queryTimes++;
|
||||
$query = $this->parseWhere($options['where']);
|
||||
$fields = $this->parseField($options['field']);
|
||||
if ($this->config['debug']) {
|
||||
$query = $this->parseWhere(!empty($options['where'])?$options['where']:'');
|
||||
$fields = $this->parseField(!empty($options['field'])?$options['field']:'');
|
||||
if (!empty($this->config['debug'])) {
|
||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.findOne(';
|
||||
$this->queryStr .= $query ? json_encode($query) : '{}';
|
||||
$this->queryStr .= $fields ? ',' . json_encode($fields) : '';
|
||||
@@ -519,7 +519,7 @@ class Mongo extends Driver
|
||||
$this->model = $options['model'];
|
||||
$this->queryTimes++;
|
||||
$query = $this->parseWhere($options['where']);
|
||||
if ($this->config['debug']) {
|
||||
if (!empty($this->config['debug'])) {
|
||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName;
|
||||
$this->queryStr .= $query ? '.find(' . json_encode($query) . ')' : '';
|
||||
$this->queryStr .= '.count()';
|
||||
|
||||
@@ -101,7 +101,7 @@ class Mongo extends \Think\Model
|
||||
}
|
||||
|
||||
// 插入数据前的回调方法
|
||||
protected function _before_insert(&$data, $options)
|
||||
protected function _before_insert(&$data, $options = [])
|
||||
{
|
||||
// 写入数据到数据库
|
||||
if ($this->_autoInc && self::TYPE_INT == $this->_idType) {
|
||||
@@ -119,7 +119,7 @@ class Mongo extends \Think\Model
|
||||
}
|
||||
|
||||
// 查询成功后的回调方法
|
||||
protected function _after_select(&$resultSet, $options)
|
||||
protected function _after_select(&$resultSet, $options = [])
|
||||
{
|
||||
array_walk($resultSet, [$this, 'checkMongoId']);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ class Mongo extends \Think\Model
|
||||
* @param integer $step 增长值
|
||||
* @return boolean
|
||||
*/
|
||||
public function setInc($field, $step = 1)
|
||||
public function setInc($field, $step = 1, $lazyTime = 0)
|
||||
{
|
||||
return $this->setField($field, ['inc', $step]);
|
||||
}
|
||||
@@ -197,7 +197,7 @@ class Mongo extends \Think\Model
|
||||
* @param integer $step 减少值
|
||||
* @return boolean
|
||||
*/
|
||||
public function setDec($field, $step = 1)
|
||||
public function setDec($field, $step = 1, $lazyTime = 0)
|
||||
{
|
||||
return $this->setField($field, ['inc', '-' . $step]);
|
||||
}
|
||||
|
||||
@@ -13,17 +13,27 @@ namespace think;
|
||||
|
||||
class Response
|
||||
{
|
||||
// 输出数据的转换方法
|
||||
protected static $tramsform = null;
|
||||
// 输出数据的类型
|
||||
protected static $type = 'html';
|
||||
// 输出数据
|
||||
protected static $data = '';
|
||||
// 是否exit
|
||||
protected static $isExit = false;
|
||||
|
||||
/**
|
||||
* 返回数据到客户端
|
||||
* 发送数据到客户端
|
||||
* @access protected
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param String $type 返回数据格式
|
||||
* @param bool $exit 是否终止执行
|
||||
* @param bool $return 是否返回数据
|
||||
* @return void
|
||||
*/
|
||||
public static function returnData($data, $type = '', $exit = true)
|
||||
public static function send($data = '', $type = '', $return = false)
|
||||
{
|
||||
$type = strtolower($type ?: self::$type);
|
||||
|
||||
$headers = [
|
||||
'json' => 'application/json',
|
||||
'xml' => 'text/xml',
|
||||
@@ -32,32 +42,86 @@ class Response
|
||||
'script' => 'application/javascript',
|
||||
'text' => 'text/plain',
|
||||
];
|
||||
$type = strtolower($type);
|
||||
|
||||
if (!headers_sent() && isset($headers[$type])) {
|
||||
header('Content-Type:' . $headers[$type] . '; charset=utf-8');
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'json':
|
||||
// 返回JSON数据格式到客户端 包含状态信息
|
||||
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||
break;
|
||||
case 'xml':
|
||||
// 返回xml格式数据
|
||||
$data = \org\Transform::xmlEncode($data);
|
||||
break;
|
||||
case 'jsonp':
|
||||
// 返回JSON数据格式到客户端 包含状态信息
|
||||
$handler = !empty($_GET[Config::get('var_jsonp_handler')]) ? $_GET[Config::get('var_jsonp_handler')] : Config::get('default_jsonp_handler');
|
||||
$data = $handler . '(' . \org\Transform::jsonEncode($data) . ');';
|
||||
break;
|
||||
$data = $data ?: self::$data;
|
||||
if (is_callable(self::$tramsform)) {
|
||||
$data = call_user_func_array(self::$tramsform, [$data]);
|
||||
} else {
|
||||
switch ($type) {
|
||||
case 'json':
|
||||
// 返回JSON数据格式到客户端 包含状态信息
|
||||
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||
break;
|
||||
case 'jsonp':
|
||||
// 返回JSON数据格式到客户端 包含状态信息
|
||||
$handler = !empty($_GET[Config::get('var_jsonp_handler')]) ? $_GET[Config::get('var_jsonp_handler')] : Config::get('default_jsonp_handler');
|
||||
$data = $handler . '(' . json_encode($data, JSON_UNESCAPED_UNICODE) . ');';
|
||||
break;
|
||||
case '':
|
||||
// 类型为空不做处理
|
||||
break;
|
||||
default:
|
||||
// 用于扩展其他返回格式数据
|
||||
Hook::listen('return_data', $data);
|
||||
}
|
||||
}
|
||||
//header('Content-Length:' . strlen($data));
|
||||
if ($exit) {
|
||||
exit($data);
|
||||
|
||||
if ($return) {
|
||||
return $data;
|
||||
} else {
|
||||
echo $data;
|
||||
}
|
||||
if (self::$isExit) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换控制器输出的数据
|
||||
* @access public
|
||||
* @param mixed $callback 调用的转换方法
|
||||
* @return void
|
||||
*/
|
||||
public static function tramsform($callback)
|
||||
{
|
||||
self::$tramsform = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出类型设置
|
||||
* @access public
|
||||
* @param string $type 输出内容的格式类型
|
||||
* @return void
|
||||
*/
|
||||
public static function type($type)
|
||||
{
|
||||
self::$type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出数据设置
|
||||
* @access public
|
||||
* @param mixed $data 输出数据
|
||||
* @return void
|
||||
*/
|
||||
public static function data($data)
|
||||
{
|
||||
self::$data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出是否exit设置
|
||||
* @access public
|
||||
* @param bool $exit 是否退出
|
||||
* @return void
|
||||
*/
|
||||
public static function isExit($exit = false)
|
||||
{
|
||||
self::$isExit = $exit;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +141,11 @@ class Response
|
||||
'time' => NOW_TIME,
|
||||
'data' => $data,
|
||||
];
|
||||
self::returnData($result, $type, true);
|
||||
|
||||
self::$data = $result;
|
||||
if ($type) {
|
||||
self::$type = $type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +171,10 @@ class Response
|
||||
$view = new \think\View();
|
||||
$result = $view->fetch(Config::get('dispatch_jump_tmpl'), $result);
|
||||
}
|
||||
self::returnData($result, $type, true);
|
||||
self::$data = $result;
|
||||
if ($type) {
|
||||
self::$type = $type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +200,10 @@ class Response
|
||||
$view = new \think\View();
|
||||
$result = $view->fetch(Config::get('dispatch_jump_tmpl'), $result);
|
||||
}
|
||||
self::returnData($result, $type, true);
|
||||
self::$data = $result;
|
||||
if ($type) {
|
||||
self::$type = $type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,32 +34,34 @@ class Route
|
||||
// 添加URL映射规则
|
||||
public static function map($map, $route = '')
|
||||
{
|
||||
self::setting('map', $map, $route);
|
||||
return self::setting('map', $map, $route);
|
||||
}
|
||||
|
||||
// 添加变量规则
|
||||
public static function pattern($name, $rule = '')
|
||||
{
|
||||
self::setting('pattern', $name, $rule);
|
||||
return self::setting('pattern', $name, $rule);
|
||||
}
|
||||
|
||||
// 添加路由别名
|
||||
public static function alias($name, $rule = '')
|
||||
{
|
||||
self::setting('alias', $name, $rule);
|
||||
return self::setting('alias', $name, $rule);
|
||||
}
|
||||
|
||||
// 添加子域名部署规则
|
||||
public static function domain($domain, $rule = '')
|
||||
{
|
||||
self::setting('domain', $domain, $rule);
|
||||
return self::setting('domain', $domain, $rule);
|
||||
}
|
||||
|
||||
// 属性设置
|
||||
private static function setting($var, $name, $value = '')
|
||||
private static function setting($var, $name = '', $value = '')
|
||||
{
|
||||
if (is_array($name)) {
|
||||
self::${$var} = array_merge(self::${$var}, $name);
|
||||
} elseif (empty($name)) {
|
||||
return self::${$var};
|
||||
} else {
|
||||
self::${$var}[$name] = $value;
|
||||
}
|
||||
@@ -309,7 +311,7 @@ class Route
|
||||
$rule = array_shift($val);
|
||||
}
|
||||
// 单项路由
|
||||
$route = $val['route'];
|
||||
$route = !empty($val['route'])?$val['route']:'';
|
||||
if (0 === strpos($rule, '/') && preg_match($rule, $url, $matches)) {
|
||||
return self::checkRegex($route, $url, $matches);
|
||||
} else {
|
||||
|
||||
@@ -615,10 +615,14 @@ class Template
|
||||
$vars = explode('.', $var);
|
||||
$var = array_shift($vars);
|
||||
$name = '$' . $var;
|
||||
foreach ($vars as $key => $val) {
|
||||
$name .= '["' . $val . '"]';
|
||||
if (count($vars) > 1) {
|
||||
foreach ($vars as $key => $val) {
|
||||
$name .= '["' . $val . '"]';
|
||||
}
|
||||
} else {
|
||||
// 一维自动识别对象和数组
|
||||
$name = 'is_array($' . $var . ')?$' . $var . '["' . $vars[0] . '"]:$' . $var . '->' . $vars[0];
|
||||
}
|
||||
|
||||
} elseif (false !== strpos($var, '[')) {
|
||||
//支持 {$var['key']} 方式输出数组
|
||||
$name = "$" . $var;
|
||||
|
||||
@@ -134,14 +134,15 @@ class Url
|
||||
$domain = $host . (strpos($host, '.') ? '' : strstr($_SERVER['HTTP_HOST'], '.'));
|
||||
} elseif (true === $domain) {
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
if (Config::get('url_domain_deplay')) {
|
||||
if (Config::get('url_domain_deploy')) {
|
||||
// 开启子域名部署
|
||||
$domain = 'localhost' == $domain ? 'localhost' : 'www' . strstr($_SERVER['HTTP_HOST'], '.');
|
||||
// '子域名'=>array('项目[/分组]');
|
||||
foreach (Config::get('url_domain_rules') as $key => $rule) {
|
||||
if (false === strpos($key, '*') && 0 === strpos($url, $rule[0])) {
|
||||
// '子域名'=>['模块[/控制器/操作]'];
|
||||
foreach (Route::domain() as $key => $rule) {
|
||||
$rule = is_array($rule) ? $rule[0] : $rule;
|
||||
if (false === strpos($key, '*') && 0 === strpos($url, $rule)) {
|
||||
$domain = $key . strstr($domain, '.'); // 生成对应子域名
|
||||
$url = substr_replace($url, '', 0, strlen($rule[0]));
|
||||
$url = substr_replace($url, '', 0, strlen($rule));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,14 @@ class View
|
||||
$this->config($config);
|
||||
$this->engine($this->config['engine_type']);
|
||||
}
|
||||
/**
|
||||
* 初始化视图
|
||||
* @access public
|
||||
* @param array $config 配置参数
|
||||
*/
|
||||
static public function getInstance(array $config = []){
|
||||
return new self($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板变量赋值
|
||||
@@ -55,6 +63,7 @@ class View
|
||||
} else {
|
||||
$this->data[$name] = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -361,9 +361,9 @@ trait Auto
|
||||
}
|
||||
return NOW_TIME >= $start && NOW_TIME <= $end;
|
||||
case 'ip_allow': // IP 操作许可验证
|
||||
return in_array(get_client_ip(), explode(',', $rule));
|
||||
return in_array($_SERVER['REMOTE_ADDR'], explode(',', $rule));
|
||||
case 'ip_deny': // IP 操作禁止验证
|
||||
return !in_array(get_client_ip(), explode(',', $rule));
|
||||
return !in_array($_SERVER['REMOTE_ADDR'], explode(',', $rule));
|
||||
case 'filter': // 使用filter_var验证
|
||||
$result = filter_var($value, is_int($rule) ? $rule : filter_id($rule));
|
||||
return false === $result ? false : true;
|
||||
|
||||
Reference in New Issue
Block a user