-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,025 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
// +---------------------------------------------------------------------- | ||
// | ThinkPHP [ WE CAN DO IT JUST THINK ] | ||
// +---------------------------------------------------------------------- | ||
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved. | ||
// +---------------------------------------------------------------------- | ||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) | ||
// +---------------------------------------------------------------------- | ||
// | Author: liu21st <liu21st@gmail.com> | ||
// +---------------------------------------------------------------------- | ||
|
||
// [ 应用入口文件 ] | ||
namespace think; | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
class TpRequestPlugin extends \Pinpoint\Plugins\Tp8PerRequest | ||
{ | ||
public function __construct() | ||
{ | ||
$blackUri = ['/favicon.ico']; | ||
// if uri in blackUri, skips it | ||
if (!in_array($_SERVER['REQUEST_URI'], $blackUri)) { | ||
parent::__construct(); | ||
} | ||
} | ||
} | ||
define('APPLICATION_NAME', 'cd.dev.test.php'); // your application name | ||
define('APPLICATION_ID', 'cd.dev.tp'); // your application id | ||
define('PP_REQ_PLUGINS', TpRequestPlugin::class); | ||
require_once __DIR__ . '/../vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php'; | ||
|
||
// 执行HTTP应用并响应 | ||
$http = (new App())->http; | ||
|
||
$response = $http->run(); | ||
|
||
$response->send(); | ||
|
||
$http->end($response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM php:8.0.30-cli | ||
|
||
|
||
RUN apt update && apt-get install -y \ | ||
libzip-dev \ | ||
zip \ | ||
git \ | ||
&& docker-php-ext-install zip pdo pdo_mysql | ||
|
||
RUN curl -sL https://github.com/pinpoint-apm/pinpoint-c-agent/releases/download/v0.6.0/install_pinpoint_php.sh | sh | ||
|
||
COPY testapps/thinkphp-php/tp /app | ||
|
||
COPY testapps/thinkphp-php/index.php /app/public/index.php | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
RUN cd /app && composer update && composer require -w pinpoint-apm/pinpoint-php-aop | ||
WORKDIR /app | ||
EXPOSE 8000 | ||
CMD [ "php" ,"think", "run" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*.log | ||
.env | ||
composer.phar | ||
composer.lock | ||
.DS_Store | ||
Thumbs.db | ||
/.idea | ||
/.vscode | ||
/vendor | ||
/.settings | ||
/.buildpath | ||
/.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
sudo: false | ||
|
||
language: php | ||
|
||
branches: | ||
only: | ||
- stable | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
before_install: | ||
- composer self-update | ||
|
||
install: | ||
- composer install --no-dev --no-interaction --ignore-platform-reqs | ||
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip . | ||
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0" | ||
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0" | ||
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0" | ||
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0" | ||
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0" | ||
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0" | ||
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0" | ||
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0" | ||
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0" | ||
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip . | ||
|
||
script: | ||
- php think unit | ||
|
||
deploy: | ||
provider: releases | ||
api_key: | ||
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw= | ||
file: | ||
- ThinkPHP_Core.zip | ||
- ThinkPHP_Full.zip | ||
skip_cleanup: true | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 | ||
版权所有Copyright © 2006-2023 by ThinkPHP (http://thinkphp.cn) | ||
All rights reserved。 | ||
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 | ||
|
||
Apache Licence是著名的非盈利开源组织Apache采用的协议。 | ||
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, | ||
允许代码修改,再作为开源或商业软件发布。需要满足 | ||
的条件: | ||
1. 需要给代码的用户一份Apache Licence ; | ||
2. 如果你修改了代码,需要在被修改的文件中说明; | ||
3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 | ||
带有原来代码中的协议,商标,专利声明和其他原来作者规 | ||
定需要包含的说明; | ||
4. 如果再发布的产品中包含一个Notice文件,则在Notice文 | ||
件中需要带有本协议内容。你可以在Notice中增加自己的 | ||
许可,但不可以表现为对Apache Licence构成更改。 | ||
具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
![](https://www.thinkphp.cn/uploads/images/20230630/300c856765af4d8ae758c503185f8739.png) | ||
|
||
ThinkPHP 8.0 | ||
=============== | ||
|
||
## 特性 | ||
|
||
* 基于PHP`8.0+`重构 | ||
* 升级`PSR`依赖 | ||
* 依赖`think-orm`3.0版本 | ||
* `6.0`/`6.1`无缝升级 | ||
|
||
|
||
> ThinkPHP8.0的运行环境要求PHP8.0.0+ | ||
现在开始,你可以使用官方提供的[ThinkChat](https://chat.topthink.com/),让你在学习ThinkPHP的旅途中享受私人AI助理服务! | ||
|
||
![](https://www.topthink.com/uploads/assistant/20230630/4d1a3f0ad2958b49bb8189b7ef824cb0.png) | ||
|
||
## 文档 | ||
|
||
[完全开发手册](https://doc.thinkphp.cn) | ||
|
||
## 服务 | ||
|
||
ThinkPHP生态服务由[顶想云](https://www.topthink.com)(TOPThink Cloud)提供,为生态提供专业的开发者服务和价值之选。 | ||
|
||
## 赞助 | ||
全新的[赞助计划](https://www.thinkphp.cn/sponsor)可以让你通过我们的网站、手册、欢迎页及GIT仓库获得巨大曝光,同时提升企业的品牌声誉,也更好保障ThinkPHP的可持续发展。 | ||
|
||
[![](https://www.thinkphp.cn/uploads/images/20230630/48396092a0515886a3da6bd268131c8f.png)](http://github.crmeb.net/u/TPSY) | ||
|
||
[![](https://www.thinkphp.cn/uploads/images/20230630/a12bd248beee0e7491dd0f79dc4dd5e9.png)](https://www.thinkphp.cn/sponsor) | ||
|
||
[![](https://www.thinkphp.cn/uploads/images/20230630/e7f48d909d41dd5ebaf4a5aa982d0455.png)](https://www.thinkphp.cn/sponsor) | ||
|
||
## 安装 | ||
|
||
~~~ | ||
composer create-project topthink/think tp | ||
~~~ | ||
|
||
启动服务 | ||
|
||
~~~ | ||
cd tp | ||
php think run | ||
~~~ | ||
|
||
然后就可以在浏览器中访问 | ||
|
||
~~~ | ||
http://localhost:8000 | ||
~~~ | ||
|
||
如果需要更新框架使用 | ||
~~~ | ||
composer update topthink/framework | ||
~~~ | ||
|
||
## 命名规范 | ||
|
||
`ThinkPHP`遵循PSR-2命名规范和PSR-4自动加载规范。 | ||
|
||
## 参与开发 | ||
|
||
直接提交PR或者Issue即可 | ||
|
||
## 版权信息 | ||
|
||
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 | ||
|
||
本项目包含的第三方源码和二进制文件之版权信息另行标注。 | ||
|
||
版权所有Copyright © 2006-2023 by ThinkPHP (http://thinkphp.cn) All rights reserved。 | ||
|
||
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 | ||
|
||
更多细节参阅 [LICENSE.txt](LICENSE.txt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deny from all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
declare (strict_types = 1); | ||
|
||
namespace app; | ||
|
||
use think\Service; | ||
|
||
/** | ||
* 应用服务类 | ||
*/ | ||
class AppService extends Service | ||
{ | ||
public function register() | ||
{ | ||
// 服务注册 | ||
} | ||
|
||
public function boot() | ||
{ | ||
// 服务启动 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
declare (strict_types = 1); | ||
|
||
namespace app; | ||
|
||
use think\App; | ||
use think\exception\ValidateException; | ||
use think\Validate; | ||
|
||
/** | ||
* 控制器基础类 | ||
*/ | ||
abstract class BaseController | ||
{ | ||
/** | ||
* Request实例 | ||
* @var \think\Request | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* 应用实例 | ||
* @var \think\App | ||
*/ | ||
protected $app; | ||
|
||
/** | ||
* 是否批量验证 | ||
* @var bool | ||
*/ | ||
protected $batchValidate = false; | ||
|
||
/** | ||
* 控制器中间件 | ||
* @var array | ||
*/ | ||
protected $middleware = []; | ||
|
||
/** | ||
* 构造方法 | ||
* @access public | ||
* @param App $app 应用对象 | ||
*/ | ||
public function __construct(App $app) | ||
{ | ||
$this->app = $app; | ||
$this->request = $this->app->request; | ||
|
||
// 控制器初始化 | ||
$this->initialize(); | ||
} | ||
|
||
// 初始化 | ||
protected function initialize() | ||
{} | ||
|
||
/** | ||
* 验证数据 | ||
* @access protected | ||
* @param array $data 数据 | ||
* @param string|array $validate 验证器名或者验证规则数组 | ||
* @param array $message 提示信息 | ||
* @param bool $batch 是否批量验证 | ||
* @return array|string|true | ||
* @throws ValidateException | ||
*/ | ||
protected function validate(array $data, string|array $validate, array $message = [], bool $batch = false) | ||
{ | ||
if (is_array($validate)) { | ||
$v = new Validate(); | ||
$v->rule($validate); | ||
} else { | ||
if (strpos($validate, '.')) { | ||
// 支持场景 | ||
[$validate, $scene] = explode('.', $validate); | ||
} | ||
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); | ||
$v = new $class(); | ||
if (!empty($scene)) { | ||
$v->scene($scene); | ||
} | ||
} | ||
|
||
$v->message($message); | ||
|
||
// 是否批量验证 | ||
if ($batch || $this->batchValidate) { | ||
$v->batch(true); | ||
} | ||
|
||
return $v->failException(true)->check($data); | ||
} | ||
|
||
} |
Oops, something went wrong.