0
0

更新代码

This commit is contained in:
2020-08-04 10:09:42 +08:00
parent 6118b5b63b
commit c2ac5d964e
478 changed files with 34410 additions and 0 deletions

36
app/Helpers/Params.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace App\Helpers;
use App\Models\Param;
class Params
{
public static function get($name, $type = 'string')
{
$value = Param::where('name', $name)->value('value');
switch ($type) {
case 'string':
return $value;
break;
case 'array':
$array = preg_split('/[\r\n]+/', trim($value, "\r\n"));
if (strpos($value, ':')) {
$value = [];
foreach ($array as $val) {
[$k, $v] = explode(':', $val, 2);
$value[$k] = $v;
}
} else {
$value = $array;
}
return $value;
break;
default:
return $value;
break;
}
}
}