mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
79470a8b3c
commit
a6bb9568fa
|
|
@ -3,7 +3,7 @@ declare (strict_types = 1);
|
||||||
|
|
||||||
namespace app;
|
namespace app;
|
||||||
|
|
||||||
use app\common\utils\Json;
|
use app\common\service\Json;
|
||||||
use think\Service;
|
use think\Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ abstract class BaseController
|
||||||
} elseif ($url) {
|
} elseif ($url) {
|
||||||
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url);
|
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
|
|
@ -161,7 +162,7 @@ abstract class BaseController
|
||||||
|
|
||||||
$type = $this->getResponseType();
|
$type = $this->getResponseType();
|
||||||
if ($type == 'html'){
|
if ($type == 'html'){
|
||||||
$response = view(config('app.exception_tmpl'), $result);
|
$response = view(config('app.dispatch_success_tmpl'), $result);
|
||||||
} else if ($type == 'json') {
|
} else if ($type == 'json') {
|
||||||
$response = json($result);
|
$response = json($result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,7 @@
|
||||||
namespace app;
|
namespace app;
|
||||||
|
|
||||||
// 应用请求对象类
|
// 应用请求对象类
|
||||||
use Spatie\Macroable\Macroable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Request
|
|
||||||
* @package app
|
|
||||||
*/
|
|
||||||
class Request extends \think\Request
|
class Request extends \think\Request
|
||||||
{
|
{
|
||||||
// 宏指令
|
|
||||||
use Macroable;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,5 @@ return [
|
||||||
// 过期时间
|
// 过期时间
|
||||||
'expire' => 1440,
|
'expire' => 1440,
|
||||||
// 前缀
|
// 前缀
|
||||||
|
'prefix' => 'ape_admin',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace app\common\service;
|
namespace app\service\service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Curl
|
* Class Curl
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace app\common\utils;
|
namespace app\common\service;
|
||||||
|
|
||||||
use think\Response;
|
use think\Response;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
<?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>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 应用设置
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
return [
|
|
||||||
// 是否强制使用路由
|
|
||||||
'url_route_must' => false,
|
|
||||||
// 合并路由规则
|
|
||||||
'route_rule_merge' => true,
|
|
||||||
// 路由是否完全匹配
|
|
||||||
'route_complete_match' => false,
|
|
||||||
// 是否自动转换URL中的控制器和操作名
|
|
||||||
'url_convert' => true,
|
|
||||||
];
|
|
||||||
|
|
@ -18,10 +18,10 @@ return [
|
||||||
'with_event' => true,
|
'with_event' => true,
|
||||||
// 默认应用
|
// 默认应用
|
||||||
'default_app' => 'index',
|
'default_app' => 'index',
|
||||||
// 开启应用快速访问
|
|
||||||
'app_express' => true,
|
|
||||||
// 默认时区
|
// 默认时区
|
||||||
'default_timezone' => 'Asia/Shanghai',
|
'default_timezone' => 'Asia/Shanghai',
|
||||||
|
// 快捷访问
|
||||||
|
'app_express' => true,
|
||||||
// 自动多应用模式
|
// 自动多应用模式
|
||||||
'auto_multi_app' => true,
|
'auto_multi_app' => true,
|
||||||
// 应用映射(自动多应用模式有效)
|
// 应用映射(自动多应用模式有效)
|
||||||
|
|
@ -29,7 +29,7 @@ return [
|
||||||
// 域名绑定(自动多应用模式有效)
|
// 域名绑定(自动多应用模式有效)
|
||||||
'domain_bind' => [],
|
'domain_bind' => [],
|
||||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||||
'deny_app_list' => ['common','addons'],
|
'deny_app_list' => ['common'],
|
||||||
|
|
||||||
// 异常页面的模板文件
|
// 异常页面的模板文件
|
||||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ return [
|
||||||
// 默认的路由变量规则
|
// 默认的路由变量规则
|
||||||
'default_route_pattern' => '[\w\.]+',
|
'default_route_pattern' => '[\w\.]+',
|
||||||
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
|
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
|
||||||
'request_cache' => false,
|
'request_cache_key' => false,
|
||||||
// 请求缓存有效期
|
// 请求缓存有效期
|
||||||
'request_cache_expire' => null,
|
'request_cache_expire' => null,
|
||||||
// 全局请求缓存排除规则
|
// 全局请求缓存排除规则
|
||||||
|
|
|
||||||
|
|
@ -11,20 +11,9 @@
|
||||||
|
|
||||||
// [ 应用入口文件 ]
|
// [ 应用入口文件 ]
|
||||||
namespace think;
|
namespace think;
|
||||||
//检测系统
|
|
||||||
|
|
||||||
/*
|
|
||||||
if(file_exists("./install/") && !file_exists("./install/install.lock")){
|
|
||||||
if($_SERVER['PHP_SELF'] != '/index.php'){
|
|
||||||
header("Content-type: text/html; charset=utf-8");
|
|
||||||
exit("请在域名根目录下安装,如:<br/> www.xxx.com/index.php 正确 <br/> www.xxx.com/www/index.php 错误,域名后面不能圈套目录, 但项目没有根目录存放限制,可以放在任意目录,apache虚拟主机配置一下即可");
|
|
||||||
}
|
|
||||||
header('Location:/install/index.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
// 执行HTTP应用并响应
|
// 执行HTTP应用并响应
|
||||||
$http = (new App())->http;
|
$http = (new App())->http;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
if (!-e $request_filename) {
|
location / {
|
||||||
rewrite ^(.*)$ /index.php?s=/$1 last;
|
if (!-e $request_filename) {
|
||||||
break;
|
rewrite ^(.*)$ /index.php?s=/$1 last;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,18 +8,10 @@
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: liu21st <liu21st@gmail.com>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
use think\facade\Route;
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
Route::get('think', function () {
|
||||||
// | 应用设置
|
return 'hello,ThinkPHP6!';
|
||||||
// +----------------------------------------------------------------------
|
});
|
||||||
|
|
||||||
return [
|
Route::get('hello/:name', 'index/hello');
|
||||||
// 是否强制使用路由
|
|
||||||
'url_route_must' => false,
|
|
||||||
// 合并路由规则
|
|
||||||
'route_rule_merge' => true,
|
|
||||||
// 路由是否完全匹配
|
|
||||||
'route_complete_match' => false,
|
|
||||||
// 是否自动转换URL中的控制器和操作名
|
|
||||||
'url_convert' => true,
|
|
||||||
];
|
|
||||||
Loading…
Reference in New Issue