mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
完善路由和域名;
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,3 +6,6 @@
|
||||
ul.db
|
||||
composer.lock
|
||||
public/upload/*
|
||||
/public/.well-known
|
||||
/public/.user.ini
|
||||
.well-known
|
||||
@@ -273,24 +273,6 @@ function check_permission($key,$admin_id = null)
|
||||
function app_url(string $url = '', array $vars = [], $suffix = true, $domain = false)
|
||||
{
|
||||
|
||||
$url_result = explode('@', $url);
|
||||
|
||||
// 在这里,@首先认为是应用名,而不是域名(或子域名)
|
||||
if (isset($url_result[1])) {
|
||||
$app_default_doamin = config('app.app_default_doamin');
|
||||
if (empty($app_default_doamin)) {
|
||||
$app_domain_bind = config('app.domain_bind');
|
||||
|
||||
if (!empty($app_domain_bind)) {
|
||||
$app_default_doamin = array_flip($app_domain_bind);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($app_default_doamin[$url_result[1]]) && $app_default_doamin[$url_result[1]] != '*') {
|
||||
|
||||
$url = $url_result[0] . "@" . $app_default_doamin[$url_result[1]];
|
||||
}
|
||||
}
|
||||
|
||||
return url($url, $vars, $suffix, $domain);
|
||||
}
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
use think\facade\Route;
|
||||
|
||||
Route::rule('a:uid', 'Post/read');
|
||||
Route::rule('i[:category_id]/s[:sub_category_id]/p[:page]', 'Index/index');
|
||||
Route::rule('i<category_id?>/s<sub_category_id?>/p<page?>', 'Index/index');
|
||||
Route::rule('i<category_id?>/s/p<page?>', 'Index/index');
|
||||
Route::rule('i/s/p<page?>', 'Index/index');
|
||||
|
||||
|
||||
@@ -23,10 +23,6 @@ return [
|
||||
'app_map' => [],
|
||||
// 域名绑定(自动多应用模式有效)
|
||||
'domain_bind' => [
|
||||
'www'=>'index',
|
||||
'admin'=>'admin',
|
||||
'api'=>'api',
|
||||
'*'=>'index',
|
||||
],
|
||||
// 应用默认域名(自动多应用模式有效,为空时采用domain_bind的设置键值对换,适合跨应用生成url)
|
||||
'app_default_doamin' => [],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="layui-header">
|
||||
|
||||
<a class="layui-logo" href="{:app_url('index/index@index')}" target="_blank">{:get_system_config('site_name')}</a>
|
||||
<a class="layui-logo" href="/" target="_blank">{:get_system_config('site_name')}</a>
|
||||
<!-- 头部区域(可配合layui已有的水平导航) PC端显示 -->
|
||||
<ul class="layui-nav layui-layout-left layui-hide-xs pc-nav-container">
|
||||
<li class="layui-nav-item header-nav-item" data-name="Index"><a href="{:url('admin/Index/index')}">首页</a></li>
|
||||
|
||||
Reference in New Issue
Block a user