diff --git a/.gitignore b/.gitignore index d465120e..78d01d79 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /.vscode /vendor *.log -.env \ No newline at end of file +.env +composer.lock \ No newline at end of file diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html deleted file mode 100644 index 535111cc..00000000 --- a/app/admin/view/index/index.html +++ /dev/null @@ -1,871 +0,0 @@ - - - - - - -SentCMS后台管理系统 - - - - - - - -
- -
-
- -
-
-
- -
-
- -
-
-
-
-{include file="setting"} - - - - - - - - \ No newline at end of file diff --git a/app/controller/Admin.php b/app/controller/Admin.php new file mode 100644 index 00000000..295b5a21 --- /dev/null +++ b/app/controller/Admin.php @@ -0,0 +1,25 @@ + +// +---------------------------------------------------------------------- +namespace app\controller; + +use app\BaseController; + +/** + * @title 后端公共模块 + */ +class Admin extends BaseController { + + protected $middleware = [ + '\app\middleware\AdminAuth' => ['except' => ['login']], + '\app\middleware\Admin' + ]; + + protected $data = ['meta' => [], 'data' => [], 'code' => 0, 'msg' => '']; + +} diff --git a/app/controller/Index.php b/app/controller/Index.php new file mode 100644 index 00000000..3ce9f67e --- /dev/null +++ b/app/controller/Index.php @@ -0,0 +1,17 @@ +*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:)

ThinkPHP V6
13载初心不改 - 你值得信赖的PHP框架

'; + } + + public function miss($name = 'ThinkPHP6') { + return 'hello,' . $name; + } +} diff --git a/app/admin/controller/Index.php b/app/controller/admin/Index.php similarity index 74% rename from app/admin/controller/Index.php rename to app/controller/admin/Index.php index 94e8f99b..649cf020 100644 --- a/app/admin/controller/Index.php +++ b/app/controller/admin/Index.php @@ -6,20 +6,25 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\admin\controller; +namespace app\controller\admin; + +use app\controller\Admin; /** * @title 后端公共模块 */ -class Index extends Base { +class Index extends Admin{ /** * @title 系统首页 */ public function index(){ - $this->data['data'] = array( - 'info' => 'ddd' - ); - return $this->fetch('', $this->data, $this->meta); + return $this->data; + } + + public function login(){ + if ($this->request->isAjax()) { + return $this->data; + } } } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php deleted file mode 100644 index c809a6f4..00000000 --- a/app/index/controller/Index.php +++ /dev/null @@ -1,17 +0,0 @@ -*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:)

ThinkPHP V6
13载初心不改 - 你值得信赖的PHP框架

'; - } - - public function hello($name = 'ThinkPHP6') - { - return 'hello,' . $name; - } -} diff --git a/app/middleware.php b/app/middleware.php index e5990933..83bed6dd 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -6,7 +6,7 @@ return [ // 多语言加载 // \think\middleware\LoadLangPack::class, // Session初始化 - // \think\middleware\SessionInit::class, + \think\middleware\SessionInit::class, // 页面Trace调试 // \think\middleware\TraceDebug::class, ]; diff --git a/app/admin/controller/Base.php b/app/middleware/Admin.php similarity index 71% rename from app/admin/controller/Base.php rename to app/middleware/Admin.php index 273ffe1e..ff52fcea 100644 --- a/app/admin/controller/Base.php +++ b/app/middleware/Admin.php @@ -6,23 +6,32 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\admin\controller; +namespace app\middleware; -use app\BaseController; use think\facade\View; /** - * @title 后台基类 + * @title 后台中间件 */ -class Base extends BaseController { +class Admin { - public $data = array(); - public $meta = array(); + protected $data = []; + + public function handle($request, \Closure $next) { + $response = $next($request); + $this->data = $response->getData(); + + if ($request->isAjax()) { + return json($this->data); + }else{ + return $response->data($this->fetch()); + } + } /** * @title 显示类 */ - public function fetch($template){ + protected function fetch($template = ''){ // 使用内置PHP模板引擎渲染模板输出 $config = array( 'tpl_replace_string' => array( @@ -35,4 +44,4 @@ class Base extends BaseController { ); return View::config($config)->assign($this->data)->fetch($template); } -} +} \ No newline at end of file diff --git a/app/admin/middleware/Admin.php b/app/middleware/AdminAuth.php similarity index 67% rename from app/admin/middleware/Admin.php rename to app/middleware/AdminAuth.php index 1f57c16d..8094570e 100644 --- a/app/admin/middleware/Admin.php +++ b/app/middleware/AdminAuth.php @@ -6,13 +6,23 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\admin\middleware; +namespace app\middleware; + +use think\facade\View; +use think\facade\Session; /** * @title 后台中间件 */ -class Admin { - public function handle($request, \Closure $next) { +class AdminAuth { + public function handle($request, \Closure $next) { + $user = Session::get('user'); + + if (Session::has('user') && $user['uid']) { + return $next($request); + }else{ + return redirect(url('admin.index/login'))->remember(); + } } } \ No newline at end of file diff --git a/app/middleware/Front.php b/app/middleware/Front.php new file mode 100644 index 00000000..18d2f2c5 --- /dev/null +++ b/app/middleware/Front.php @@ -0,0 +1,50 @@ + +// +---------------------------------------------------------------------- +namespace app\middleware; + +use think\facade\View; + +/** + * @title 后台中间件 + */ +class Front { + + protected $data = []; + + public function handle($request, \Closure $next) { + $response = $next($request); + $this->data = $response->getData(); + + if ($request->isAjax()) { + return json($this->data); + }else{ + return $response->data($this->fetch()); + } + } + + /** + * @title 显示类 + */ + protected function fetch($template = ''){ + // 使用内置PHP模板引擎渲染模板输出 + $config = array( + 'tpl_replace_string' => array( + '__static__' => '/static', + '__img__' => '/static/admin/images', + '__css__' => '/static/admin/css', + '__js__' => '/static/admin/js', + '__public__' => '/static/admin', + ) + ); + if (is_string($this->data)) { + $this->data = array('data' => $this->data); + } + return View::config($config)->assign($this->data)->fetch($template); + } +} \ No newline at end of file diff --git a/app/view/admin/index/index.html b/app/view/admin/index/index.html new file mode 100644 index 00000000..2570b4a4 --- /dev/null +++ b/app/view/admin/index/index.html @@ -0,0 +1,326 @@ + + + + + + +SentCMS后台管理系统 + + + + + + + +
+ + +
+{include file="admin/setting"} + + + + + + + + \ No newline at end of file diff --git a/app/view/admin/index/login.html b/app/view/admin/index/login.html new file mode 100644 index 00000000..9830d5e7 --- /dev/null +++ b/app/view/admin/index/login.html @@ -0,0 +1,108 @@ + + + + +SentCMS后台管理系统-后台登录 + + + + + + + + + + + \ No newline at end of file diff --git a/app/admin/view/setting.html b/app/view/admin/setting.html similarity index 100% rename from app/admin/view/setting.html rename to app/view/admin/setting.html diff --git a/app/view/index/index.html b/app/view/index/index.html new file mode 100644 index 00000000..51052015 --- /dev/null +++ b/app/view/index/index.html @@ -0,0 +1,39 @@ + + + + + + +SentCMS网站管理系统 + + + + + + +
+ +
+
+ SentCMS网站管理系统 +
+ + +
+
+ + diff --git a/app/view/index/miss.html b/app/view/index/miss.html new file mode 100644 index 00000000..413f0acd --- /dev/null +++ b/app/view/index/miss.html @@ -0,0 +1,39 @@ + + + + + + +SentCMS网站管理系统 + + + + + + +
+ +
+
+ 404 Not Found! +
+ + +
+
+ + \ No newline at end of file diff --git a/composer.json b/composer.json index f0211eb8..cba19fda 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,10 @@ "require": { "php": ">=7.1.0", "topthink/framework": "6.0.*-dev", - "topthink/think-view": "^1.0", - "symfony/var-dumper":"^4.2" + "topthink/think-view": "^1.0" + }, + "require-dev": { + "symfony/var-dumper": "^4.2" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 5b0eebf7..31be9797 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,151 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2b198878f2331e428e4bdc9512a87fa5", + "content-hash": "0bae2a09cc872cd4f33b7a8d7a193d96", "packages": [ { - "name": "opis/closure", - "version": "3.1.6", + "name": "league/flysystem", + "version": "1.0.53", "source": { "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "ccb8e3928c5c8181c76cdd0ed9366c5bcaafd91b" + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "08e12b7628f035600634a5e76d95b5eb66cea674" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/ccb8e3928c5c8181c76cdd0ed9366c5bcaafd91b", - "reference": "ccb8e3928c5c8181c76cdd0ed9366c5bcaafd91b", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/08e12b7628f035600634a5e76d95b5eb66cea674", + "reference": "08e12b7628f035600634a5e76d95b5eb66cea674", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2019-06-18T20:09:29+00:00" + }, + { + "name": "league/flysystem-cached-adapter", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", + "shasum": "" + }, + "require": { + "league/flysystem": "~1.0", + "psr/cache": "^1.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0", + "tedivm/stash": "~0.12" + }, + "suggest": { + "ext-phpredis": "Pure C implemented extension for PHP" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Cached\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "frankdejonge", + "email": "info@frenky.net" + } + ], + "description": "An adapter decorator to enable meta-data caching.", + "time": "2018-07-09T20:51:04+00:00" + }, + { + "name": "opis/closure", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "f846725591203098246276b2e7b9e8b7814c4965" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/f846725591203098246276b2e7b9e8b7814c4965", + "reference": "f846725591203098246276b2e7b9e8b7814c4965", "shasum": "" }, "require": { @@ -25,12 +156,12 @@ }, "require-dev": { "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0|^5.0|^6.0|^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "3.3.x-dev" } }, "autoload": { @@ -65,7 +196,7 @@ "serialization", "serialize" ], - "time": "2019-02-22T10:30:00+00:00" + "time": "2019-05-31T20:04:32+00:00" }, { "name": "psr/cache", @@ -257,21 +388,213 @@ ], "time": "2017-10-23T01:57:42+00:00" }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/ab50dcf166d5f577978419edd37aa2bb8eabce0c", + "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "45d6ef73671995aca565a1aa3d9a432a3ea63f91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/45d6ef73671995aca565a1aa3d9a432a3ea63f91", + "reference": "45d6ef73671995aca565a1aa3d9a432a3ea63f91", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2019-06-17T17:37:00+00:00" + }, { "name": "topthink/framework", "version": "6.0.x-dev", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "f2a3948ff4194bc0bd198da48dcb74197d147bce" + "reference": "a73dfadfffd884b59856d35e90bed695fbe0d33f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/f2a3948ff4194bc0bd198da48dcb74197d147bce", - "reference": "f2a3948ff4194bc0bd198da48dcb74197d147bce", + "url": "https://api.github.com/repos/top-think/framework/zipball/a73dfadfffd884b59856d35e90bed695fbe0d33f", + "reference": "a73dfadfffd884b59856d35e90bed695fbe0d33f", "shasum": "" }, "require": { + "league/flysystem": "^1.0", + "league/flysystem-cached-adapter": "^1.0", "opis/closure": "^3.1", "php": ">=7.1.0", "psr/cache": "~1.0", @@ -312,7 +635,7 @@ "orm", "thinkphp" ], - "time": "2019-04-30T10:43:43+00:00" + "time": "2019-06-29T07:44:17+00:00" }, { "name": "topthink/think-template", diff --git a/config/app.php b/config/app.php index e4183c69..51b737c8 100644 --- a/config/app.php +++ b/config/app.php @@ -25,7 +25,7 @@ return [ // 是否启用事件 'with_event' => true, // 自动多应用模式 - 'auto_multi_app' => true, + 'auto_multi_app' => false, // 应用映射(自动多应用模式有效) 'app_map' => [], // 域名绑定(自动多应用模式有效) diff --git a/config/database.php b/config/database.php index 18f7efe9..a9a01e80 100644 --- a/config/database.php +++ b/config/database.php @@ -15,6 +15,17 @@ return [ // 默认使用的数据库连接配置 'default' => Env::get('database.driver', 'mysql'), + // 自定义时间查询规则 + 'time_query_rule' => [], + + // 自动写入时间戳字段 + // true为自动识别类型 false关闭 + // 字符串则明确指定时间字段类型 支持 int timestamp datetime date + 'auto_timestamp' => true, + + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + // 数据库连接配置信息 'connections' => [ 'mysql' => [ @@ -30,8 +41,6 @@ return [ 'password' => Env::get('database.password', ''), // 端口 'hostport' => Env::get('database.hostport', '3306'), - // 连接dsn - 'dsn' => '', // 数据库连接参数 'params' => [], // 数据库编码默认采用utf8 @@ -52,18 +61,10 @@ return [ 'fields_strict' => true, // 是否需要进行SQL性能分析 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '', // 是否需要断线重连 'break_reconnect' => false, ], // 更多的数据库配置信息 ], - // 自动写入时间戳字段 - 'auto_timestamp' => 'timestamp', - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', ]; diff --git a/config/filesystem.php b/config/filesystem.php index a0c5744c..b6a0c5cf 100644 --- a/config/filesystem.php +++ b/config/filesystem.php @@ -6,11 +6,11 @@ return [ 'default' => Env::get('filesystem.driver', 'local'), 'disks' => [ 'local' => [ - 'driver' => 'local', - 'root' => app()->getRuntimePath() . 'storage', + 'type' => 'local', + 'root' => app()->getRuntimePath() . 'storage', ], 'public' => [ - 'driver' => 'local', + 'type' => 'local', 'root' => app()->getRootPath() . 'public/storage', 'url' => '/storage', 'visibility' => 'public', diff --git a/config/log.php b/config/log.php index b3d87b4a..47c726d4 100644 --- a/config/log.php +++ b/config/log.php @@ -8,23 +8,46 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- +use think\facade\Env; // +---------------------------------------------------------------------- // | 日志设置 // +---------------------------------------------------------------------- return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', + // 默认日志记录通道 + 'default' => Env::get('log.channel', 'file'), // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 是否关闭日志写入 - 'close' => false, + 'level' => [], + // 日志类型记录的通道 ['error'=>'email',...] + 'type_channel' => [], + // 关闭全局日志写入 + 'close' => false, + // 全局日志处理 支持闭包 + 'processor' => null, + + // 日志通道列表 + 'channels' => [ + 'file' => [ + // 日志记录方式 + 'type' => 'File', + // 日志保存目录 + 'path' => '', + // 单文件日志写入 + 'single' => false, + // 独立日志级别 + 'apart_level' => [], + // 最大日志文件数量 + 'max_files' => 0, + // 使用JSON格式记录 + 'json' => false, + // 日志处理 + 'processor' => null, + // 关闭通道日志写入 + 'close' => false, + // 日志输出格式化 + 'format' => '[%s][%s] %s', + ], + // 其它日志通道配置 + ], + ]; diff --git a/config/route.php b/config/route.php index 1a6048d4..36686a6f 100644 --- a/config/route.php +++ b/config/route.php @@ -28,8 +28,6 @@ return [ 'route_rule_merge' => false, // 路由是否完全匹配 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, // 是否开启路由缓存 'route_check_cache' => false, // 路由缓存连接参数 diff --git a/route/app.php b/route/app.php index d8e09e38..021dc98d 100644 --- a/route/app.php +++ b/route/app.php @@ -10,8 +10,11 @@ // +---------------------------------------------------------------------- use think\facade\Route; -Route::get('think', function () { - return 'hello,ThinkPHP6!'; +Route::group('admin', function(){ + Route::rule('/', 'admin.index/index'); + //Route::rule(':controller', 'admin.:controller/index'); + Route::rule('login', 'admin.index/login'); + Route::rule(':controller/:function', 'admin.:controller/:function'); }); -Route::get('hello/:name', 'index/hello'); +Route::miss('index/miss'); \ No newline at end of file