字符串隐藏
This commit is contained in:
parent
378ef5f3ab
commit
0786c89c38
@ -22,6 +22,7 @@ use think\exception\ValidateException;
|
|||||||
use app\admin\controller\Uzip;
|
use app\admin\controller\Uzip;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use taoler\com\Api;
|
use taoler\com\Api;
|
||||||
|
use taoler\com\Str;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
|
||||||
class Upgrade extends AdminController
|
class Upgrade extends AdminController
|
||||||
@ -43,9 +44,14 @@ class Upgrade extends AdminController
|
|||||||
|
|
||||||
/** 升级界面 */
|
/** 升级界面 */
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{ //字符隐藏
|
||||||
$sys_version_num = Db::name('system')->field('sys_version_num,key,upcheck_url,upgrade_url')->find(1);
|
$key = Str::func_substr_replace($this->sys['key']);
|
||||||
View::assign('ver_num',$sys_version_num);
|
$sys_base = [
|
||||||
|
'key' => $key,
|
||||||
|
'upcheck_url' => $this->sys['upcheck_url'],
|
||||||
|
'upgrade_url' => $this->sys['upgrade_url'],
|
||||||
|
];
|
||||||
|
View::assign('ver_num',$sys_base);
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
extend/taoler/com/Str.php
Normal file
28
extend/taoler/com/Str.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace taoler\com;
|
||||||
|
|
||||||
|
class Str
|
||||||
|
{
|
||||||
|
// 隐藏部分字符串
|
||||||
|
public static function func_substr_replace($str, $replacement = '*', $start = 5, $length = 30)
|
||||||
|
{
|
||||||
|
$len = mb_strlen($str,'utf-8');
|
||||||
|
if ($len > intval($start+$length)) {
|
||||||
|
$str1 = mb_substr($str,0,$start,'utf-8');
|
||||||
|
$str2 = mb_substr($str,intval($start+$length),NULL,'utf-8');
|
||||||
|
} else {
|
||||||
|
$str1 = mb_substr($str,0,1,'utf-8');
|
||||||
|
$str2 = mb_substr($str,$len-1,1,'utf-8');
|
||||||
|
$length = $len - 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_str = $str1;
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$new_str .= $replacement;
|
||||||
|
}
|
||||||
|
$new_str .= $str2;
|
||||||
|
return $new_str;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user