<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace think;
use ArrayAccess;
use think\facade\Lang;
use think\file\UploadedFile;
use think\route\Rule;
/**
* 请求管理类
* @package think
*/
class Request implements ArrayAccess
{
/**
* 兼容PATH_INFO获取
* @var array
*/
protected $pathinfoFetch = ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'];
/**
* PATHINFO变量名 用于兼容模式
* @var string
*/
protected $varPathinfo = 's';
/**
* 请求类型
* @var string
*/
protected $varMethod = '_method';
/**
* 表单ajax伪装变量
* @var string
*/
protected $varAjax = '_ajax';
/**
* 表单pjax伪装变量
* @var string
*/
protected $varPjax = '_pjax';
/**
* 域名根
* @var string
*/
protected $rootDomain = '';
/**
* HTTPS代理标识
* @var string
*/
protected $httpsAgentName = '';
/**
* 前端代理服务器IP
* @var array
*/
protected $proxyServerIp = [];
/**
* 前端代理服务器真实IP头
* @var array
*/
protected $proxyServerIpHeader = ['HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP'];
/**
* 请求类型
* @var string
*/
protected $method;
/**
* 域名(含协议及端口)
* @var string
*/
protected $domain;
/**
* HOST(含端口)
* @var string
*/
protected $host;
/**
* 子域名
* @var string
*/
protected $subDomain;
/**
* 泛域名
* @var string
*/
protected $panDomain;
/**
* 当前URL地址
* @var string
*/
protected $url;
/**
* 基础URL
* @var string
*/
protected $baseUrl;
/**
* 当前执行的文件
* @var string
*/
protected $baseFile;
/**
* 访问的ROOT地址
* @var string
*/
protected $root;
/**
* pathinfo
* @var string
*/
protected $pathinfo;
/**
* pathinfo(不含后缀)
* @var string
*/
protected $path;
/**
* 当前请求的IP地址
* @var string
*/
protected $realIP;
/**
* 当前控制器名
* @var string
*/
protected $controller;
/**
* 当前操作名
* @var string
*/
protected $action;
/**
* 当前请求参数
* @var array
*/
protected $param = [];
/**
* 当前GET参数
* @var array
*/
protected $get = [];
/**
* 当前POST参数
* @var array
*/
protected $post = [];
/**
* 当前REQUEST参数
* @var array
*/
protected $request = [];
/**
* 当前路由对象
* @var Rule
*/
protected $rule;
/**
* 当前ROUTE参数
* @var array
*/
protected $route = [];
/**
* 中间件传递的参数
* @var array
*/
protected $middleware = [];
/**
* 当前PUT参数
* @var array
*/
protected $put;
/**
* SESSION对象
* @var Session
*/
protected $session;
/**
* COOKIE数据
* @var array
*/
protected $cookie = [];
/**
* ENV对象
* @var Env
*/
protected $env;
/**
* 当前SERVER参数
* @var array
*/
protected $server = [];
/**
* 当前FILE参数
* @var array
*/
protected $file = [];
/**
* 当前HEADER参数
* @var array
*/
protected $header = [];
/**
* 资源类型定义
* @var array
*/
protected $mimeType = [
'xml' => 'application/xml,text/xml,application/x-xml',
'json' => 'application/json,text/x-json,application/jsonrequest,text/json',
'js' => 'text/javascript,application/javascript,application/x-javascript',
'css' => 'text/css',
'rss' => 'application/rss+xml',
'yaml' => 'application/x-yaml,text/yaml',
'atom' => 'application/atom+xml',
'pdf' => 'application/pdf',
'text' => 'text/plain',
'image' => 'image/png,image/jpg,image/jpeg,image/pjpeg,image/gif,image/webp,image/*',
'csv' => 'text/csv',
'html' => 'text/html,application/xhtml+xml,*/*',
];
/**
* 当前请求内容
* @var string
*/
protected $content;
/**
* 全局过滤规则
* @var array
*/
protected $filter;
/**
* php://input内容
* @var string
*/
// php://input
protected $input;
/**
* 请求安全Key
* @var string
*/
protected $secureKey;
/**
* 是否合并Param
* @var bool
*/
protected $mergeParam = false;
/**
* 架构函数
* @access public
*/
public function __construct()
{
// 保存 php://input
$this->input = file_get_contents('php://input');
}
public static function __make(App $app)
{
$request = new static();
if (function_exists('apache_request_headers') && $result = apache_request_headers()) {
$header = $result;
} else {
$header = [];
$server = $_SERVER;
foreach ($server as $key => $val) {
if (0 === strpos($key, 'HTTP_')) {
$key = str_replace('_', '-', strtolower(substr($key, 5)));
$header[$key] = $val;
}
}
if (isset($server['CONTENT_TYPE'])) {
$header['content-type'] = $server['CONTENT_TYPE'];
}
if (isset($server['CONTENT_LENGTH'])) {
$header['content-length'] = $server['CONTENT_LENGTH'];
}
}
$request->header = array_change_key_case($header);
$request->server = $_SERVER;
$request->env = $app->env;
$inputData = $request->getInputData($request->input);
$request->get = $_GET;
$request->post = $_POST ?: $inputData;
$request->put = $inputData;
$request->request = $_REQUEST;
$request->cookie = $_COOKIE;
$request->file = $_FILES ?? [];
return $request;
}
/**
* 设置当前包含协议的域名
* @access public
* @param string $domain 域名
* @return $this
*/
public function setDomain(string $domain)
{
$this->domain = $domain;
return $this;
}
/**
* 获取当前包含协议的域名
* @access public
* @param bool $port 是否需要去除端口号
* @return string
*/
public function domain(bool $port = false): string
{
return $this->scheme() . '://' . $this->host($port);
}
/**
* 获取当前根域名
* @access public
* @return string
*/
public function rootDomain(): string
{
$root = $this->rootDomain;
if (!$root) {
$item = explode('.', $this->host());
$count = count($item);
$root = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0];
}
return $root;
}
/**
* 设置当前泛域名的值
* @access public
* @param string $domain 域名
* @
没有合适的资源?快使用搜索试试~ 我知道了~
微信公众号多域名回调系统 微信公众号多域名回调功能:微信公众号后台默认只能授权2个网页域名,用本系统突破这个限制,用同一个公众号
共430个文件
php:329个
md:17个
html:13个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 89 浏览量
2023-09-13
14:20:43
上传
评论 1
收藏 949KB ZIP 举报
温馨提示
这是一款基于ThinkPHP6.0开发的微信公众号多域名回调系统。本系统有如下功能: 微信公众号多域名回调功能:微信公众号后台默认只能授权2个网页域名,用本系统突破这个限制,用同一个公众号对接无限多个网站。网站后台支持回调域名白名单的管理,以及登录记录的查看。 微信access_token获取功能:可让本系统作为中控服务器统一获取和刷新access_token,其他业务逻辑站点所使用的access_token均调用当前站点获取,这样可避免各自刷新造成冲突,导致access_token覆盖而影响业务。 微信消息事件转发功能:微信公众平台/企业微信的服务器设置只能填写1个url,用本系统可以同时转发给多个url。如用户关注事件、用户发送的消息等,可以同时发送给多个服务器站点。 支付宝开放平台多域名回调功能:每个支付宝开发平台应用只能配置1个授权回调域名,用本系统突破这个限制,可同时在多个网站使用同一个支付宝开放平台应用。 部署方法: · 运行环境要求PHP7.4+,MySQL5.6+ · 设置网站运行目录为public · 设置伪静态为ThinkPHP · 访问网站,会自
资源推荐
资源详情
资源评论
收起资源包目录
微信公众号多域名回调系统
微信公众号多域名回调功能:微信公众号后台默认只能授权2个网页域名,用本系统突破这个限制,用同一个公众号 (430个子文件)
bootstrap-table.css 9KB
admin.css 797B
phpunit.xml.dist 826B
phpunit.xml.dist 559B
.editorconfig 271B
.example.env 279B
hiddeninput.exe 9KB
.gitattributes 70B
.gitignore 104B
.gitignore 52B
.gitignore 37B
.gitignore 29B
.gitignore 27B
.gitignore 13B
.gitignore 13B
.gitignore 6B
.gitignore 6B
.htaccess 224B
.htaccess 13B
index.html 11KB
index.html 10KB
servergroup.html 9KB
wxtoken.html 8KB
serveritem.html 6KB
login.html 5KB
doc.html 5KB
domain.html 5KB
layout.html 3KB
record.html 3KB
index.html 2KB
set.html 2KB
error.html 859B
jquery.particleground.min.js 10KB
custom.js 3KB
installed.json 19KB
composer.json 1KB
composer.json 902B
composer.json 848B
composer.json 720B
composer.json 687B
composer.json 626B
composer.json 562B
composer.json 559B
composer.json 552B
composer.json 418B
composer.json 395B
LICENSE 11KB
LICENSE 11KB
LICENSE 11KB
LICENSE 11KB
LICENSE 2KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
PSR7-Interfaces.md 9KB
PSR7-Usage.md 5KB
CONTRIBUTING.md 4KB
README.md 2KB
README.md 2KB
README.md 2KB
README.md 1KB
LICENSE.md 1KB
CHANGELOG.md 1KB
README.md 931B
README.md 767B
README.md 677B
README.md 662B
README.md 578B
README.md 563B
README.md 508B
README.md 215B
Request.php 54KB
PDOConnection.php 52KB
Template.php 47KB
Validate.php 46KB
Builder.php 42KB
BaseQuery.php 36KB
Mongo.php 33KB
RelationShip.php 26KB
Model.php 25KB
Cx.php 24KB
Route.php 24KB
Rule.php 23KB
Console.php 23KB
Mongo.php 21KB
helper.php 18KB
BelongsToMany.php 18KB
Admin.php 18KB
Mongo.php 18KB
Attribute.php 18KB
WhereQuery.php 16KB
Collection.php 16KB
ModelRelationQuery.php 16KB
ClassLoader.php 16KB
Mysql.php 16KB
InstalledVersions.php 16KB
Arr.php 16KB
Container.php 15KB
共 430 条
- 1
- 2
- 3
- 4
- 5
资源评论
百创科技
- 粉丝: 1478
- 资源: 230
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功