提交服务端基础框架

This commit is contained in:
wanghao
2025-03-12 12:18:06 +08:00
parent b2dc631969
commit 7c1b4f1a4f
11794 changed files with 3510099 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace app\common;
class Utils {
/**
* 获取URL
*
* @param $url
* @return string
*/
static public function absoluteUrl($url) {
if (!empty($_SERVER['HTTP_HOST'])) {
return (!empty($_SERVER['HTTPS']) ? 'https' : 'http')
. '://' . $_SERVER['HTTP_HOST']
. ($url{0} === '/' ? $url : '/' . $url);
} else {
return config('config.domain') . ($url{0} === '/' ? $url : '/' . $url);
}
}
/**
* 计算熟知
*
* @param $total
* @param $number1
* @param $number2
*/
static public function allocNumber($total, & $number1, & $number2) {
if ($number1 > 0 OR $number2 > 0) {
$number1 = $total * ($number1 / ($number1 + $number2));
$number2 = $total - $number1;
}
}
}