18 Star 54 Fork 10

Jon Lee / Tadmin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
helper.php 2.08 KB
一键复制 编辑 原始数据 按行查看 历史
Jon Lee 提交于 2020-11-06 18:41 . feat: update to thinkphp6
<?php
use tadmin\model\Config;
if (!function_exists('script_path')) {
function script_path()
{
if ('cli' == PHP_SAPI) {
$scriptName = realpath($_SERVER['argv'][0]);
} else {
$scriptName = $_SERVER['SCRIPT_FILENAME'];
}
return realpath(dirname($scriptName)) . '/';
}
}
if (!function_exists('app_path')) {
function app_path($path = '')
{
return env('app_path') . ltrim($path, '/');
}
}
if (!function_exists('public_path')) {
function public_path($path = '')
{
return script_path() . ltrim($path, '/');
// return app_path('../public/').ltrim($path, '/');
}
}
if (!function_exists('admin_path')) {
function admin_path($path = '')
{
return __DIR__ . '/' . ltrim($path, '/');
}
}
if (!function_exists('admin_config_path')) {
function admin_config_path($path = '')
{
return admin_path('config/') . ltrim($path, '/');
}
}
if (!function_exists('admin_route_path')) {
function admin_route_path($path = '')
{
return admin_path('route/') . ltrim($path, '/');
}
}
if (!function_exists('admin_view_path')) {
function admin_view_path($path = '')
{
return admin_path('resource/view/') . ltrim($path, '/');
}
}
if (!function_exists('site_config')) {
function site_config($key)
{
return Config::get($key);
}
}
if (!function_exists('array_deep_merge')) {
function array_deep_merge(array $a, array $b)
{
foreach ($a as $key => $val) {
if (isset($b[$key])) {
if (gettype($a[$key]) != gettype($b[$key])) {
continue;
}
if (is_array($a[$key])) {
$a[$key] = array_deep_merge($a[$key], $b[$key]);
} else {
$a[$key] = $b[$key];
}
}
}
return $a;
}
}
if (!function_exists('redirect_route')) {
function redirect_route(string $route = '', int $code = 302)
{
return redirect((string)url($route), $code);
}
}
PHP
1
https://gitee.com/leeqvip/tadmin.git
git@gitee.com:leeqvip/tadmin.git
leeqvip
tadmin
Tadmin
master

搜索帮助