feat: 添加index应用模块
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
declare (strict_types = 1);
|
|
||||||
|
|
||||||
namespace app\home\controller;
|
|
||||||
|
|
||||||
class Index
|
|
||||||
{
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return '您好!这是一个[home]示例应用';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12
app/index/controller/Index.php
Normal file
12
app/index/controller/Index.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\index\controller;
|
||||||
|
|
||||||
|
class Index
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return '您好!这是一个[' . lang('home') . ']示例应用';
|
||||||
|
}
|
||||||
|
}
|
||||||
5
app/index/lang/en-us.php
Normal file
5
app/index/lang/en-us.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'home' => 'Home',
|
||||||
|
];
|
||||||
5
app/index/lang/zh-cn.php
Normal file
5
app/index/lang/zh-cn.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'home' => '首页',
|
||||||
|
];
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
// 这是系统自动生成的middleware定义文件
|
// 这是系统自动生成的middleware定义文件
|
||||||
return [
|
return [
|
||||||
|
// 启用多语言支持
|
||||||
|
'think\middleware\LoadLangPack',
|
||||||
];
|
];
|
||||||
13
app/index/route/v1.php
Normal file
13
app/index/route/v1.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
use think\facade\Route;
|
||||||
|
|
||||||
|
Route::get('/', 'Index/index');
|
||||||
@@ -7,7 +7,7 @@ return [
|
|||||||
// 默认语言
|
// 默认语言
|
||||||
'default_lang' => env('DEFAULT_LANG', 'zh-cn'),
|
'default_lang' => env('DEFAULT_LANG', 'zh-cn'),
|
||||||
// 允许的语言列表
|
// 允许的语言列表
|
||||||
'allow_lang_list' => [],
|
'allow_lang_list' => ['zh-cn', 'en-us'],
|
||||||
// 多语言自动侦测变量名
|
// 多语言自动侦测变量名
|
||||||
'detect_var' => 'lang',
|
'detect_var' => 'lang',
|
||||||
// 是否使用Cookie记录
|
// 是否使用Cookie记录
|
||||||
@@ -23,5 +23,5 @@ return [
|
|||||||
'zh-hans-cn' => 'zh-cn',
|
'zh-hans-cn' => 'zh-cn',
|
||||||
],
|
],
|
||||||
// 是否支持语言分组
|
// 是否支持语言分组
|
||||||
'allow_group' => false,
|
'allow_group' => true,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ return [
|
|||||||
// 是否使用控制器后缀
|
// 是否使用控制器后缀
|
||||||
'controller_suffix' => false,
|
'controller_suffix' => false,
|
||||||
// 默认模块名(开启自动多模块有效)
|
// 默认模块名(开启自动多模块有效)
|
||||||
'default_module' => 'home',
|
'default_module' => 'index',
|
||||||
// 默认控制器名
|
// 默认控制器名
|
||||||
'default_controller' => 'Index',
|
'default_controller' => 'Index',
|
||||||
// 默认操作名
|
// 默认操作名
|
||||||
|
|||||||
Reference in New Issue
Block a user