diff --git a/.DS_Store b/.DS_Store index 5008ddf..08e6b23 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.env b/.env new file mode 100644 index 0000000..3741e2e --- /dev/null +++ b/.env @@ -0,0 +1,12 @@ +[app] + +debug = true + +[database] + +host = 127.0.0.1 +port = 3306 +dbuser = root +dbpwd = 123456 +dbname = linkphp +dbprefix = lp_ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4e9f780 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +sudo: false + +language: php + +before_install: + - composer self-update + +install: + - composer install --no-dev --no-interaction --ignore-platform-reqs + +script: + - php bin/cli test diff --git a/LICENSE b/LICENSE index 8dada3e..105d831 100755 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,46 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Copyright (c) + +Anti 996 License Version 1.0 (Draft) + +Permission is hereby granted to any individual or legal entity +obtaining a copy of this licensed work (including the source code, +documentation and/or related items, hereinafter collectively referred +to as the "licensed work"), free of charge, to deal with the licensed +work for any purpose, including without limitation, the rights to use, +reproduce, modify, prepare derivative works of, distribute, publish +and sublicense the licensed work, subject to the following conditions: + +1. The individual or the legal entity must conspicuously display, +without modification, this License and the notice on each redistributed +or derivative copy of the Licensed Work. + +2. The individual or the legal entity must strictly comply with all +applicable laws, regulations, rules and standards of the jurisdiction +relating to labor and employment where the individual is physically +located or where the individual was born or naturalized; or where the +legal entity is registered or is operating (whichever is stricter). In +case that the jurisdiction has no such laws, regulations, rules and +standards or its laws, regulations, rules and standards are +unenforceable, the individual or the legal entity are required to +comply with Core International Labor Standards. + +3. The individual or the legal entity shall not induce or force its +employee(s), whether full-time or part-time, or its independent +contractor(s), in any methods, to agree in oral or written form, to +directly or indirectly restrict, weaken or relinquish his or her +rights or remedies under such laws, regulations, rules and standards +relating to labor and employment as mentioned above, no matter whether +such written or oral agreement are enforceable under the laws of the +said jurisdiction, nor shall such individual or the legal entity +limit, in any methods, the rights of its employee(s) or independent +contractor(s) from reporting or complaining to the copyright holder or +relevant authorities monitoring the compliance of the license about +its violation(s) of the said license. + +THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION WITH THE +LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. diff --git a/README.md b/README.md index a7dcc8d..99316a8 100755 --- a/README.md +++ b/README.md @@ -10,10 +10,12 @@ ``` -#### LinkPHP (临克) 是面向对象的轻量级常驻内存型PHP API开发框架 。 +QQ: 750688237 有兴趣的可以一起探讨,项目还需要完善 +#### linkphp (临克) 是面向对象的轻量级常驻内存型PHP API开发框架 。 -## **http服务器启动(常驻内存模式)** + +## **http服务器启动(常驻内存模式) [需要swoole扩展]** 进入 @@ -26,6 +28,19 @@ bin\ php httpd start //启动 php httpd stop //停止 + _ _ _ +| | | | _ ___ | | ___ +| | ___ | | / / / _ \| |_ / _ \ +| | | \ \| |/ / | |_| || _ \ | |_| | +| |_| |\ V |\ \ | .___/| | | || .___/ +|_____| \ _' \_\ | | | | | || | + +[2018年06月01日 15:43:12] Server Name: linkphp-httpd +[2018年06月01日 15:43:12] PHP Version: 7.1.7 +[2018年06月01日 15:43:12] Swoole Version: 2.1.3 +[2018年06月01日 15:43:12] Listen Address: 127.0.0.1 +[2018年06月01日 15:43:12] Listen Port: 9508 + 第一种方式:使用linkphp提倡的以常驻内存形式启动方式,前端可以配合nginx负载均衡使用 第二种方式:传统的LNMP/LAMP方式启动,则将根目录定义到src/web目录下 @@ -52,8 +67,106 @@ server { ``` +## **WebSocket服务端启动(常驻内存模式)** + +```php + +首先注册一个websocket路由 + +Router::ws('chat','/app/ws/Handle#ws'); + +在Handle控制器继承WebSocketInterface接口实现接口中的方法 + +use linkphp\swoole\websocket\WebSocketInterface; +use swoole_http_response; +use swoole_websocket_server; +use swoole_http_request; +use swoole_server; +use swoole_websocket_frame; + +class Handle implements WebSocketInterface +{ + + public function HandShake(swoole_http_request $request, swoole_http_response $response) + { + echo "server: handshake success with fd{$request->fd}\n"; + } + + public function open(swoole_websocket_server $svr, swoole_http_request $req) + { + echo "server: open success with fd{$req->fd}\n"; + } + + public function message(swoole_server $server, swoole_websocket_frame $frame) + { + echo "receive from {$frame->fd}:{$frame->data},opcode:{$frame->opcode},fin:{$frame->finish}\n"; + $server->push($frame->fd, "this is server"); + } + + public function close($ser, $fd) + { + echo "client {$fd} closed\n"; + } + +} + +然后进入bin目录 + +php ws start //启动 +php ws stop //停止 + +websocket相关配置在conf/bin/ws.php内 + +之后客户端发起 ws://127.0.0.1:9510/chat 连接将会触发注册的websocket路由 + +``` + +## **PhpRpc服务端启动(常驻内存模式)** + +```php + +php phprpc start //启动 +php phprpc stop //停止 + + _ + ___ | | ___ ___ ___ ___ +/ _ \| |_ / _ \ / _ \ / _ \ / __ \ +| |_| || _ \ | |_| | | |_| | | |_| | | | +| .___/| | | || .___/ | .\ \. | .___/ \ .__ +| | | | | || | | | \ \| | \___/ + +[2018年06月01日 15:43:12] Server Name: phprpc +[2018年06月01日 15:43:12] PHP Version: 7.1.7 +[2018年06月01日 15:43:12] Swoole Version: 2.1.3 +[2018年06月01日 15:43:12] Listen Address: 127.0.0.1 +[2018年06月01日 15:43:12] Listen Port: 9518 + +``` + +## **PhpRpc注册中心启动(常驻内存模式)** + +```php + +php phprpc_center start //启动 +php phprpc_center stop //停止 + + _ + ___ | | ___ ___ ___ ___ +/ _ \| |_ / _ \ / _ \ / _ \ / __ \ +| |_| || _ \ | |_| | | |_| | | |_| | | | +| .___/| | | || .___/ | .\ \. | .___/ \ .__ +| | | | | || | | | \ \| | \___/ + +[2018年06月01日 15:43:12] Server Name: phprpc-center +[2018年06月01日 15:43:12] PHP Version: 7.1.7 +[2018年06月01日 15:43:12] Swoole Version: 2.1.3 +[2018年06月01日 15:43:12] Listen Address: 127.0.0.1 +[2018年06月01日 15:43:12] Listen Port: 9520 + +``` + ## **使用交流** -LinkPHP开发动态:www.linkphp.cn +linkphp开发动态:www.linkphp.cn ###目前框架空目录都是必须创建的目录根据命名规范即可自动寻址加载相关文件 @@ -75,11 +188,11 @@ LinkPHP开发动态:www.linkphp.cn ## **使用方法** -####事件使用 +#### 事件使用 ```php -use linkphp\Application; +use framework\Application; //接收两个参数,第一个参数为标签,第二个参数可以一组类的数组也可以为类名 @@ -134,7 +247,7 @@ return [ ```php use linkphp\db\Db; -use linkphp\Application; +use framework\Application; //助手函数链式操作方法 db()->table('')->where('')->select(); @@ -201,7 +314,7 @@ return [ #### restful使用说明 ```php -use linkphp\Application; +use framework\Application; //使用linkphp开发api应用 @@ -244,7 +357,7 @@ request()->isPatch(); namespace app\controller\main; use linkphp\http\HttpRequest; -use linkphp\Application; +use framework\Application; class Home { @@ -299,7 +412,7 @@ Application::bind( ```php -use linkphp\Application; +use framework\Application; //获取缓存 cache('test'); @@ -316,7 +429,7 @@ Application::cache('test','test'); ```php -use linkphp\Application; +use framework\Application; //input参数接收操作 @@ -369,7 +482,7 @@ request()->input('get.',function($value){ ```php -use linkphp\Application; +use framework\Application; //中间件使用 //框架中实现了6个中间件 @@ -435,15 +548,16 @@ Application::middleware('beginMiddleware',function (Closure $v) { ```php -use linkphp\Application; +use framework\Application; //路由使用 -//在configure目录下route.php路由配置文件中进行配置使用 +//在src目录下route.php路由配置文件中进行配置使用 + +//Router::get(':id/:test', '/addons/test/Test@main'); +Router::get('/', '/http/home/main'); return [ - '/main/home/main' => function(\linkphp\router\Router $router){ - return '/main/home/main'; - }, +// ':id/:test' => ['/main/home/main',['method' => 'get']], ]; //键名为当前请求的路径 @@ -452,8 +566,12 @@ return [ //闭包使用方法 -Application::router('index/getUser',function(){ - return 1; +use linkphp\http\HttpRequest; + +Router::get(':id/:test', function(HttpRequest $httpRequest,$id){ + dump($id); + dump($httpRequest); + return '闭包路由'; }); ``` @@ -462,7 +580,7 @@ Application::router('index/getUser',function(){ ```php -use linkphp\Application; +use framework\Application; //view层使用 Application::view('main/home/main',[ @@ -479,6 +597,40 @@ view('main/home/main',['linkphp' => 'linkphp']); ``` +#### 验证器使用 + +```php + +Validator::data('w') + ->withValidator('url', function ($validator, $input){ + $validator->addValidator($input,['rule' => [ + 'class' => 'url', 'param' => [] + ], 'errorMessage' => '非法URL地址' + ]); + }); + if(!Validator::check()){ + dump(Validator::geterror());die; + } + +``` + +#### 分页器使用 + +```php + +use linkphp\page\Paginator; + +//查出待分页的总数 +$count = Db::table('lp_user')->count('id'); +//实例化分页器传入总数以及每页数量 +$page = new Paginator($count,2); +//获取limit参数 +$data = Db::table('lp_user')->limit($page->limit())->select(); +//渲染分页条 +$page->render(); + +``` + #### 命令行使用说明 ```php @@ -496,7 +648,7 @@ php cli +命令名 namespace app\command\main; -use linkphp\Application; +use framework\Application; use linkphp\console\Command; class Test extends Command diff --git a/bin/cli b/bin/cli index c0b6723..078ecd1 100755 --- a/bin/cli +++ b/bin/cli @@ -32,7 +32,7 @@ $app->event( $kernel = $app->make(bin\console\Kernel::class); -$kernel->use() +$kernel->start() ->then(function () use ($kernel,$app){ $kernel->setData($app->make(linkphp\console\Console::class) ->getReturnData()); diff --git a/bin/command/Test.php b/bin/command/Test.php index 589882e..e2116f7 100644 --- a/bin/command/Test.php +++ b/bin/command/Test.php @@ -2,7 +2,7 @@ namespace bin\command; -use linkphp\Application; +use framework\Application; use linkphp\console\Command; class Test extends Command diff --git a/bin/command/WebSocket.php b/bin/command/WebSocket.php index 9c7d95a..18b3819 100644 --- a/bin/command/WebSocket.php +++ b/bin/command/WebSocket.php @@ -4,7 +4,7 @@ use linkphp\process\Process; use swoole_websocket_server; -use linkphp\Application; +use framework\Application; use linkphp\console\Command; use linkphp\process\drives\Swoole; diff --git a/bin/console/Kernel.php b/bin/console/Kernel.php index 3b2ecdc..d9f836e 100644 --- a/bin/console/Kernel.php +++ b/bin/console/Kernel.php @@ -2,24 +2,24 @@ namespace bin\console; -use linkphp\Kernel as ConsoleKernel; +use framework\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { - public function use($config = null) + public function start($config = null) { // TODO: Implement request() method. - $this->_app->event('error'); + $this->app->event('error'); // TODO: Implement use() method. - $this->_app->event('console'); + $this->app->event('console'); // TODO: Implement response() method. return $this; } public function complete() { - $httpRequest = $this->_app->make('linkphp\http\HttpRequest'); + $httpRequest = $this->app->make('linkphp\http\HttpRequest'); $httpRequest->setRequestHttpAccept('console'); $httpRequest->setData($this->data)->send(); // TODO: Implement complete() method. diff --git a/bin/exception/HttpdHandle.php b/bin/exception/HttpdHandle.php new file mode 100644 index 0000000..21e5c54 --- /dev/null +++ b/bin/exception/HttpdHandle.php @@ -0,0 +1,23 @@ +getErrorType()}: \n"; + $error_info .= "message: {$error->getMessage()} \n"; + $error_info .= "file: {$error->getFile()} \n"; + $error_info .= "line: {$error->getLine()} \n"; + $error_info .= "datetime: {$error->getTimestamp()} \n"; + $error_info .= "trace: {$error->getTrace()} \n"; + + echo $error_info; + } + +} \ No newline at end of file diff --git a/bin/http/Kernel.php b/bin/http/Kernel.php index 0babe7f..459612e 100644 --- a/bin/http/Kernel.php +++ b/bin/http/Kernel.php @@ -2,32 +2,32 @@ namespace bin\http; -use linkphp\Kernel as ConsoleKernel; +use framework\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { - public function use($config = null) + public function start($config = null) { // TODO: Implement request() method. - $this->_app->event('error'); + $this->app->event('error'); // TODO: Implement use() method. - $this->_app->make(\linkphp\console\Console::class) + $this->app->make(\linkphp\console\Console::class) ->setDaemon(true) ->setDaemonConfig($config); /** * 设置应用启动中间件并监听执行 */ - app()->hook('appMiddleware'); - $this->_app->event('console'); + $this->app->hook('appMiddleware'); + $this->app->event('console'); // TODO: Implement response() method. return $this; } public function complete() { - $httpRequest = $this->_app->make(\linkphp\http\HttpRequest::class); - return $httpRequest->setData($this->data)->send(true); + parent::beforeComplete(); + return $this->request->setData($this->data)->send(true); // TODO: Implement complete() method. } diff --git a/bin/httpd b/bin/httpd index b727d08..c2dce6f 100755 --- a/bin/httpd +++ b/bin/httpd @@ -22,7 +22,7 @@ $app = require_once(ROOT_PATH . 'src/bootstrap.php'); $app->event( 'error', - \app\provider\ErrorProvider::class + \bin\provider\ErrorProvider::class ); $app->event( @@ -37,5 +37,5 @@ $app->event( $kernel = $app->make(bin\http\Kernel::class); -$kernel->use(LOAD_PATH . 'httpd.php'); +$kernel->start(LOAD_PATH . 'bin/httpd.php'); //这是命令行执行入口文件 \ No newline at end of file diff --git a/bin/link b/bin/link new file mode 100644 index 0000000..4164b11 --- /dev/null +++ b/bin/link @@ -0,0 +1,33 @@ +#!/usr/bin/env php +event( + 'error', + \bin\provider\ErrorProvider::class +); + +$app->event( + 'console', + \bin\provider\ConsoleProvider::class +); + +$kernel = $app->make(bin\console\Kernel::class); + +$kernel->daemon(function () use($app){ + // TODO: Implement request() method. + $app->event('error'); + // TODO: Implement use() method. + $app->make(\linkphp\console\Console::class) + ->setDaemon(true) + ->setDaemonConfig(LOAD_PATH . 'bin/reload.php'); + $app->event('console'); +}); + +//这是命令行执行入口文件 \ No newline at end of file diff --git a/bin/link.sh b/bin/link.sh new file mode 100755 index 0000000..0e53890 --- /dev/null +++ b/bin/link.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello World !" \ No newline at end of file diff --git a/src/application/controller/main/Test.php b/bin/middleware/BinTest.php similarity index 56% rename from src/application/controller/main/Test.php rename to bin/middleware/BinTest.php index d27a589..fdbe2cd 100644 --- a/src/application/controller/main/Test.php +++ b/bin/middleware/BinTest.php @@ -1,14 +1,16 @@ // +---------------------------------------------------------------------- -// | 配置类 +// | 命令行入口文件 // +---------------------------------------------------------------------- -namespace app\controller\main; -use linkphp\event\EventDefinition; -use linkphp\event\EventServerProvider; +//目录基础常量的定义 +define('ROOT_PATH', dirname(__DIR__) . '/'); +//加载自动加载方法 +require(ROOT_PATH . 'vendor/linkphp/loader/src/Loader.php'); +//加载LinkPHP框架启动文件 +$app = require_once(ROOT_PATH . 'src/bootstrap.php'); -class Event implements EventServerProvider -{ - public function update(EventDefinition $definition) - { - dump(2); - return $definition; - // TODO: Implement update() method. - } -} \ No newline at end of file +$app->event( + 'error', + \bin\provider\ErrorProvider::class +); + +$app->event( + 'console', + \bin\provider\DaemonProvider::class +); + +$app->event( + 'router', + \app\provider\RouterProvider::class +); + +$kernel = $app->make(bin\http\Kernel::class); + +$kernel->start(LOAD_PATH . 'bin/phprpc.php'); +//这是命令行执行入口文件 \ No newline at end of file diff --git a/bin/phprpc_center b/bin/phprpc_center new file mode 100644 index 0000000..fa31773 --- /dev/null +++ b/bin/phprpc_center @@ -0,0 +1,41 @@ +#!/usr/bin/env php + +// +---------------------------------------------------------------------- +// | 命令行入口文件 +// +---------------------------------------------------------------------- + +//目录基础常量的定义 +define('ROOT_PATH', dirname(__DIR__) . '/'); +//加载自动加载方法 +require(ROOT_PATH . 'vendor/linkphp/loader/src/Loader.php'); +//加载LinkPHP框架启动文件 +$app = require_once(ROOT_PATH . 'src/bootstrap.php'); + +$app->event( + 'error', + \app\provider\ErrorProvider::class +); + +$app->event( + 'console', + \bin\provider\DaemonProvider::class +); + +$app->event( + 'router', + \app\provider\RouterProvider::class +); + +$kernel = $app->make(bin\http\Kernel::class); + +$kernel->start(LOAD_PATH . 'bin/phprpc_center.php'); +//这是命令行执行入口文件 \ No newline at end of file diff --git a/bin/provider/ConsoleProvider.php b/bin/provider/ConsoleProvider.php index c46b6aa..11c1d53 100644 --- a/bin/provider/ConsoleProvider.php +++ b/bin/provider/ConsoleProvider.php @@ -4,18 +4,12 @@ use linkphp\event\EventDefinition; use linkphp\event\EventServerProvider; -use linkphp\Exception; -use linkphp\Application; class ConsoleProvider implements EventServerProvider { public function update(EventDefinition $definition) { - Application::httpRequest() - ->setCmdParam( - Application::input('server.argv') - ); - Application::make(\linkphp\console\Console::class) + app()->make(\linkphp\console\Console::class) ->import( require LOAD_PATH . 'command.php' )->init(); diff --git a/bin/provider/DaemonProvider.php b/bin/provider/DaemonProvider.php index 6c5cf7a..ddfa449 100644 --- a/bin/provider/DaemonProvider.php +++ b/bin/provider/DaemonProvider.php @@ -4,19 +4,14 @@ use linkphp\event\EventDefinition; use linkphp\event\EventServerProvider; -use linkphp\Exception; -use linkphp\Application; +use framework\Exception; class DaemonProvider implements EventServerProvider { public function update(EventDefinition $definition) { - Application::httpRequest() - ->setCmdParam( - Application::input('server.argv') - ); - Application::make(\linkphp\console\Console::class)->init(); + app()->make(\linkphp\console\Console::class)->init(); return $definition; // TODO: Implement update() method. } diff --git a/bin/provider/ErrorProvider.php b/bin/provider/ErrorProvider.php index 6159a51..078afbe 100644 --- a/bin/provider/ErrorProvider.php +++ b/bin/provider/ErrorProvider.php @@ -10,11 +10,16 @@ class ErrorProvider implements EventServerProvider { public function update(EventDefinition $definition) { - Error::register( - Error::instance() + $error = new Error(); + $error->register( + $error->setErrorView(EXTRA_PATH . 'tpl/error.html') ->setDebug(true) - ->setErrHandle('linkphp\\error\\exception\\Console') + ->setErrHandle('bin\\exception\\HttpdHandle') )->complete(); + app()->containerInstance( + 'linkphp\error\Error', + $error + ); return $definition; // TODO: Implement update() method. } diff --git a/bin/rpc/Kernel.php b/bin/rpc/Kernel.php new file mode 100644 index 0000000..d8fa327 --- /dev/null +++ b/bin/rpc/Kernel.php @@ -0,0 +1,34 @@ +app->event('error'); + // TODO: Implement use() method. + $this->app->make(\linkphp\console\Console::class) + ->setDaemon(true) + ->setDaemonConfig($config); + /** + * 设置应用启动中间件并监听执行 + */ + app()->hook('appMiddleware'); + $this->app->event('console'); + // TODO: Implement response() method. + return $this; + } + + public function complete() + { + $httpRequest = $this->app->make(\linkphp\http\HttpRequest::class); + return $httpRequest->setData($this->data)->send(true); + // TODO: Implement complete() method. + } + +} \ No newline at end of file diff --git a/bin/ws b/bin/ws new file mode 100644 index 0000000..90143d8 --- /dev/null +++ b/bin/ws @@ -0,0 +1,38 @@ +#!/usr/bin/env php +event( + 'error', + \bin\provider\ErrorProvider::class +); + +$app->event( + 'console', + \bin\provider\ConsoleProvider::class +); + +$app->event( + 'router', + \app\provider\RouterProvider::class +); + +$kernel = $app->make(bin\console\Kernel::class); + +$kernel->daemon(function () use($app){ + // TODO: Implement request() method. + $app->event('error'); + // TODO: Implement use() method. + $app->make(\linkphp\console\Console::class) + ->setDaemon(true) + ->setDaemonConfig(LOAD_PATH . 'bin/ws.php'); + $app->event('console'); +}); + +//这是命令行执行入口文件 \ No newline at end of file diff --git a/composer.json b/composer.json index 5bb1400..4d9db68 100755 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } }, "require":{ - "php": "^5.4 || ^7.0", + "php": "^5.5 || ^7.0", "linkphp/framework":"dev-master", "linkphp/db":"dev-master", "linkphp/cache":"dev-master", @@ -26,7 +26,6 @@ "linkphp/page":"dev-master", "linkphp/upload":"dev-master", "linkphp/verify":"dev-master", - "linkphp/image":"dev-master", "linkphp/curl":"dev-master", "linkphp/router":"dev-master", "linkphp/event":"dev-master", @@ -35,14 +34,15 @@ "linkphp/console":"dev-master", "linkphp/http":"dev-master", "linkphp/session":"dev-master", - "linkphp/filter":"dev-master", - "linkphp/form":"dev-master", + "linkphp/validator":"dev-master", "linkphp/di":"dev-master", "linkphp/middleware":"dev-master", "linkphp/template":"dev-master", "liugene/links":"dev-master", "linkphp/loader":"dev-master", "linkphp/process":"dev-master", - "linkphp/swoole":"dev-master" + "linkphp/swoole":"dev-master", + "linkphp/cookie":"dev-master", + "phprpc/phprpc":"dev-master" } } diff --git a/conf/httpd.php b/conf/bin/httpd.php similarity index 79% rename from conf/httpd.php rename to conf/bin/httpd.php index 9639dae..4438cdd 100644 --- a/conf/httpd.php +++ b/conf/bin/httpd.php @@ -3,9 +3,11 @@ return [ // HttpServer 'daemon' => 'linkphp\\console\\daemon\\HttpServer', + 'enable_static_handler' => true, + 'document_root' => ROOT_PATH . 'src/web', 'server' => [ // 类路径 - 'class' => 'linkphp\swoole\HttpServer', + 'class' => 'linkphp\swoole\http\HttpdServer', // 主机 'host' => '127.0.0.1', // 端口 @@ -21,7 +23,7 @@ // PID 文件 'pid_file' => RUNTIME_PATH . 'run/link-httpd.pid', // 日志文件路径 - 'log_file' => RUNTIME_PATH . 'tmp/link-httpd.log', + 'log_file' => RUNTIME_PATH . 'log/link-httpd.log', // 子进程运行用户 /* 'user' => 'www', */ ] diff --git a/conf/bin/phprpc.php b/conf/bin/phprpc.php new file mode 100644 index 0000000..99f7b5c --- /dev/null +++ b/conf/bin/phprpc.php @@ -0,0 +1,34 @@ + 'phprpc\\server\\PhpRpcServer', + 'server' => [ + // 类路径 + 'class' => 'phprpc\swoole\PhpRpcServer', + // 主机 + 'host' => '127.0.0.1', + // 端口 + 'port' => 8868, + // 运行时的各项参数:https://wiki.swoole.com/wiki/page/274.html + 'setting' => [ + // 连接处理线程数 + 'reactor_num' => 1, //reactor thread num + 'worker_num' => 1, //worker process num + 'backlog' => 128, //listen backlog + 'max_request' => 1, + 'open_length_check' => true, + 'package_length_type' => 'N', + 'package_body_offset' => 0, + 'package_length_offset' => 4, + 'package_max_length' => 2000000, + 'dispatch_mode' => 1, + // PID 文件 + 'pid_file' => RUNTIME_PATH . 'run/phprpc.pid', + // 日志文件路径 + 'log_file' => RUNTIME_PATH . 'tmp/phprpc.log', + // 子进程运行用户 + /* 'user' => 'www', */ + ] + ] +]; \ No newline at end of file diff --git a/conf/bin/phprpc_center.php b/conf/bin/phprpc_center.php new file mode 100644 index 0000000..2b115b6 --- /dev/null +++ b/conf/bin/phprpc_center.php @@ -0,0 +1,36 @@ + 'phprpc\\server\\PhpRpcCenterServer', + 'enable_static_handler' => true, + 'document_root' => VENDOR_PATH . 'phprpc/src/center/web', + 'server' => [ + // 类路径 + 'class' => 'phprpc\swoole\PhpRpcCenterServer', + // 主机 + 'host' => '127.0.0.1', + // 端口 + 'port' => 8869, + // 运行时的各项参数:https://wiki.swoole.com/wiki/page/274.html + 'setting' => [ + // 连接处理线程数 + 'reactor_num' => 1, //reactor thread num + 'worker_num' => 1, //worker process num + 'backlog' => 128, //listen backlog + 'max_request' => 1, + 'open_length_check' => true, + 'package_length_type' => 'N', + 'package_body_offset' => 0, + 'package_length_offset' => 4, + 'package_max_length' => 2000000, + 'dispatch_mode' => 1, + // PID 文件 + 'pid_file' => RUNTIME_PATH . 'run/phprpc_center.pid', + // 日志文件路径 + 'log_file' => RUNTIME_PATH . 'tmp/phprpc_center.log', + // 子进程运行用户 + /* 'user' => 'www', */ + ] + ] +]; \ No newline at end of file diff --git a/conf/bin/reload.php b/conf/bin/reload.php new file mode 100644 index 0000000..2eb7c8c --- /dev/null +++ b/conf/bin/reload.php @@ -0,0 +1,19 @@ + 'linkphp\\console\\daemon\\HotReload', + 'server' => [ + // 类路径 + 'class' => 'linkphp\swoole\Reload', + // 运行时的各项参数:https://wiki.swoole.com/wiki/page/274.html + 'setting' => [ + // PID 文件 + 'pid_file' => RUNTIME_PATH . 'run/hot-reload.pid', + // 日志文件路径 + 'log_file' => RUNTIME_PATH . 'tmp/hot-reload.log', + // 子进程运行用户 + /* 'user' => 'www', */ + ] + ] +]; \ No newline at end of file diff --git a/conf/bin/ws.php b/conf/bin/ws.php new file mode 100644 index 0000000..8d319cf --- /dev/null +++ b/conf/bin/ws.php @@ -0,0 +1,29 @@ + 'linkphp\\console\\daemon\\WS', + 'server' => [ + // 类路径 + 'class' => 'linkphp\swoole\websocket\WebSocketServer', + // 主机 + 'host' => '127.0.0.1', + // 端口 + 'port' => 9510, + // 运行时的各项参数:https://wiki.swoole.com/wiki/page/274.html + 'setting' => [ + // 连接处理线程数 + 'reactor_num' => 1, //reactor thread num + 'worker_num' => 1, //worker process num + 'backlog' => 128, //listen backlog + 'max_request' => 1, + 'dispatch_mode' => 1, + // PID 文件 + 'pid_file' => RUNTIME_PATH . 'run/ws.pid', + // 日志文件路径 + 'log_file' => RUNTIME_PATH . 'log/ws.log', + // 子进程运行用户 + /* 'user' => 'www', */ + ] + ] +]; \ No newline at end of file diff --git a/conf/build.php b/conf/build.php deleted file mode 100644 index 0b67a5f..0000000 --- a/conf/build.php +++ /dev/null @@ -1,3 +0,0 @@ - 'File', + // 缓存保存目录 + 'path' => RUNTIME_PATH . 'temp/temp_cache/', + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + 'ext' => '.php' +]; \ No newline at end of file diff --git a/conf/configure.php b/conf/configure.php index 4f60a30..e186a7c 100755 --- a/conf/configure.php +++ b/conf/configure.php @@ -16,33 +16,18 @@ return [ //'配置项' => '配置值', - //默认视图文件配置 - 'default_temp_theme' => 'default', - 'default_temp_type' => '1', //默认模板引擎,0=>LinkPHP默认原生PHP,1=>Smarty模板引擎,2=>Links模板引擎 - 'default_theme_suffix' => '.html', //默认视图文件后缀 - 'temp_cache' => false, //是否开启模板缓存 - 'set_left_limiter' => '{', //设置模板引擎左侧解析标签 - 'set_right_limiter' => '}', //设置模板引擎右侧解析标签 - - - //扩展配置开关 - 'extend_model_config' => false, - - //系统语言包设置 - 'default_language' => 'cn', //设置系统语言'cn'简体中文,'tw'繁体中文,'en'英语。默认中文 - - //站点调试 - 'app_debug' => true, //是否打开调试功能 + 'app_debug' => ENV::get('app.debug', true), //是否打开调试功能 //系统安全配置 'token_turn_on' => false, //是否打开表单令牌验证 - //系统引擎配置 - 'session_on' => true, //是否开启SESSION机制 - //系统常用路径设置 'log_path' => CACHE_PATH . 'log/', //系统日志存储路径 + 'default_return_type' => 'view', //view json console xml jsonp + + 'dispatch_error_tmpl' => 'tpl/dispatch_jump', + ]; diff --git a/conf/cookie.php b/conf/cookie.php new file mode 100644 index 0000000..6f1e8a7 --- /dev/null +++ b/conf/cookie.php @@ -0,0 +1,9 @@ + '', + 'domain' => '', + 'secure' => '', + 'httponly' => '', + 'expire' => '' +]; \ No newline at end of file diff --git a/conf/database.php b/conf/database.php index 3a7f027..56015ca 100755 --- a/conf/database.php +++ b/conf/database.php @@ -1,15 +1,19 @@ 'mysql:host=127.0.0.1;dbname=linkphp', 'dns' => '', - 'host' => '127.0.0.1', //一般不需要修改 - 'port' => '3306', //默认即可 - 'dbuser' => 'root', //数据库用户名 - 'dbpwd' => '', //数据库密码 + 'host' => Env::get('database.host', '127.0.0.1'), //一般不需要修改 + 'port' => Env::get('database.port', '3306'), //默认即可 + 'dbuser' => Env::get('database.dbuser', 'root'), //数据库用户名 + 'dbpwd' => Env::get('database.dbpwd', '123456'), //数据库密码 'charset' => 'utf8', //数据库编码 - 'dbname' => 'linkphp', //数据库名称 - 'dbprefix' => 'lp_', //数据库表前缀 + 'dbname' => Env::get('database.dbname', 'linkphp'), //数据库名称 + 'dbprefix' => Env::get('database.dbprefix', 'lp_'), //数据库表前缀 'db_type' => 'mysql', //数据库类型 默认Mysql + 'result_type' => PDO::FETCH_ASSOC, + // 时间字段取出后的默认时间格式,默认为Y-m-d H:i:s + 'datetime_format' => true, + // Query类 + 'query' => \linkphp\db\Query::class, ]; \ No newline at end of file diff --git a/conf/main/configure.php b/conf/main/configure.php deleted file mode 100755 index 2ae6908..0000000 --- a/conf/main/configure.php +++ /dev/null @@ -1,21 +0,0 @@ - '配置值', - 'HOST' => '测试Index配置', - //'DEFAULT_THEME_SUFFIX' => 'html', -); diff --git a/conf/map.php b/conf/map.php index a4337a3..e2a9b31 100755 --- a/conf/map.php +++ b/conf/map.php @@ -21,9 +21,6 @@ 'bin\\' => [ ROOT_PATH . 'bin' ], - 'linkphp\\' => [ - ROOT_PATH . 'vendor/linkphp/framework/src/linkphp' - ], ], //psr0命名空间 'autoload_namespace_psr0' => [ @@ -33,19 +30,10 @@ 'autoload_namespace_file' => [ //'文件名' => '映射路径地址' 'defined' => ROOT_PATH . 'vendor/linkphp/framework/src/define.php', - 'app_func' => ROOT_PATH . 'conf/common.php', + 'app_func' => ROOT_PATH . 'src/common.php', 'framework_func' => ROOT_PATH . 'vendor/linkphp/framework/src/helper.php' ], 'class_autoload_map' => [ //'类名' => '类文件地址' - 'Db' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Db.php', - 'Console' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Console.php', - 'Component' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Component.php', - 'Definition' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Definition.php', - 'Event' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Event.php', - 'HttpRequest' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/HttpRequest.php', - 'Config' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Config.php', - 'Router' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Router.php', - 'Error' => ROOT_PATH . 'vendor/linkphp/framework/src/linkphp/facade/Error.php', ], ]; \ No newline at end of file diff --git a/conf/middleware.php b/conf/middleware.php index d1ba980..5233df2 100644 --- a/conf/middleware.php +++ b/conf/middleware.php @@ -15,6 +15,7 @@ return [ 'beginMiddleware' => [ + \app\middleware\App::class ], 'appMiddleware' => [ diff --git a/conf/route.php b/conf/route.php deleted file mode 100755 index a5aeafa..0000000 --- a/conf/route.php +++ /dev/null @@ -1,5 +0,0 @@ - [], -]; \ No newline at end of file diff --git a/conf/rpc/customer/center.php b/conf/rpc/customer/center.php new file mode 100644 index 0000000..b993871 --- /dev/null +++ b/conf/rpc/customer/center.php @@ -0,0 +1,3 @@ + 'msm-center', //服务名称 + 'ip' => "0.0.0.0", + 'port' => 9600, + 'notify_port' => 9601, + 'services' => [ + 'MessageService' => [ + + ], + ] +]; \ No newline at end of file diff --git a/conf/rpc/customer/services.php b/conf/rpc/customer/services.php new file mode 100644 index 0000000..48c7b38 --- /dev/null +++ b/conf/rpc/customer/services.php @@ -0,0 +1,7 @@ + 'user-center', //服务名称 + 'ip' => "0.0.0.0", + 'port' => 9512, + 'services' => [ + 'UserService' => [ + // 其他业务参数 +// 'version' => 'xxx', +// 'group' => 'xxx', +// ... + ], + 'StudentUserService' => [ + // 其他业务参数 +// 'version' => 'xxx', +// 'group' => 'xxx', +// ... + ], + ] +]; \ No newline at end of file diff --git a/conf/rpc/provider/services.php b/conf/rpc/provider/services.php new file mode 100644 index 0000000..2981f11 --- /dev/null +++ b/conf/rpc/provider/services.php @@ -0,0 +1,7 @@ + '', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // SESSION 前缀 + 'prefix' => 'zq', + // 驱动方式 支持redis memcache memcached + 'type' => '', + // 是否自动开启 SESSION + 'session_on' => true, + // session 保存时间 + 'expire' => 86400, + // session 保存路径 + 'path' => '/', + // session 有效域名 + 'domain' => 'zuanqun.com', + // session 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => '', +]; \ No newline at end of file diff --git a/conf/view.php b/conf/view.php new file mode 100644 index 0000000..391ca43 --- /dev/null +++ b/conf/view.php @@ -0,0 +1,17 @@ + 'default', + 'default_theme_suffix' => '.html', //默认视图文件后缀 + 'temp_cache' => false, //是否开启模板缓存 + 'set_left_limiter' => '<{', //设置模板引擎左侧解析标签 + 'set_right_limiter' => '}>', //设置模板引擎右侧解析标签 + 'view_replace_str' => [], + + // 模板路径 + 'view_path' => '', + + 'storage_drive' => 'File', + 'cache_time' => '1800', + 'tpl_replace_string' => [] +]; \ No newline at end of file diff --git a/src/application/Kernel.php b/src/application/Kernel.php index 1b39267..d80363c 100644 --- a/src/application/Kernel.php +++ b/src/application/Kernel.php @@ -2,26 +2,31 @@ namespace app; -use linkphp\Kernel as RouterKernel; +use framework\Kernel as RouterKernel; class Kernel extends RouterKernel { - public function use($config = null) + public function start($config = null) { // TODO: Implement request() method. - $this->_app->event('error'); - $this->_app->event('router'); + $this->app->event('error'); + $this->app->event('router'); // TODO: Implement response() method. // TODO: Implement use() method. /** * 设置应用启动中间件并监听执行 */ - $this->_app->hook('appMiddleware'); - $this->_app->get(\linkphp\router\Router::class) + + $this->app->hook('appMiddleware'); + $this->app->get(\linkphp\router\Router::class) ->setPath( - $this->_app->input('server.PATH_INFO') - )->setGetParam($this->_app->input('get.')) + $this->app->input('server.REQUEST_URI')) + ->setGetParam( + $this->app->input('get.')) + ->setMethod( + $this->request->getRequestMethod() + ) ->parser() ->dispatch(); return $this; @@ -29,10 +34,11 @@ public function use($config = null) public function complete() { - $this->_app->hook('destructMiddleware'); - $httpRequest = $this->_app->make('linkphp\http\HttpRequest'); + $this->app->hook('destructMiddleware'); + + parent::beforeComplete(); - $httpRequest->setData($this->data)->send(); + $this->request->setData($this->data)->send(); } } \ No newline at end of file diff --git a/src/application/command/Test.php b/src/application/command/Test.php index a77a362..582b22d 100644 --- a/src/application/command/Test.php +++ b/src/application/command/Test.php @@ -2,7 +2,7 @@ namespace app\command; -use linkphp\Application; +use framework\Application; use linkphp\console\Command; class Test extends Command diff --git a/src/application/controller/main/First.php b/src/application/controller/main/First.php deleted file mode 100644 index c7e86ca..0000000 --- a/src/application/controller/main/First.php +++ /dev/null @@ -1,14 +0,0 @@ - 1, 'msg' => 'linkphp start']; -// Application::view('main/home/main',[ -// 'linkphp' => 'linkphp' -// ]);die; - dump(app()->getContainerInstance());die; -// dump(Config::get(''));die; -// dump(Db::table('lp_download')->sum('id'));die; -// dump(Db::table('lp_download')->count('id'));die; -// dump(Db::select('select * from lp_download a -//left join lp_down_item b on a.id = b.down_id -//left join lp_user c on a.u_id = c.id where a.id = ?',[1])->get());die; - dump(Db::table('lp_download a') - ->join('left join lp_down_item b on a.id = b.down_id') -// ->join('left join lp_user c on a.u_id = c.id') - ->leftJoin('lp_user c on a.u_id = c.id') - ->where('a.id>1') - ->select()); - dump(Db::table('lp_download')->getLastSql());die; -// dump(Db::select('select * from lp_user where id = ?',[1])->get());die; -// dump(Db::table('lp_user')->where('id=3')->delete());die; -// dump(Db::table('lp_user')->where('id = 1')->setInc('pass_word'));die; -// dump(Db::table('lp_user')->where('id=1')->update( -// ['user_name' => 'bananabook','pass_word' => '123'] -// )); -// dump(Db::getTable());die; - dump(Db::table('lp_user')->field('id')->where('id = 1')->find()); - dump(Db::table('lp_user')->field('id')->where('id = 1')->select());die; -// dump(Application::db()->select('select id from lp_forum '));die; -// dump(Application::db()->table('lp_forum')->field('id')->select());die; - return ['code' => 1,'msg' => 'test']; - dump(confirm_zeeyer_compiled('zeeyer'));die; - dump($this->view('main/home/main',['linkphp' => 'linkphp']));die; - dump(request()); - dump(db());die; - dump(Application::db());die; - dump(Application::cache('test'));die; - dump(Application::cache('test','test'));die; - Application::view('main/home/main',[ - 'linkphp' => 'linkphp' - ]);die; - dump(Db::table('zq_user')->where('id=11')->update());die; - dump(Db::table('zq_user')->where('id=11')->delete());die; - dump(Db::table('zq_user')->insertAll([['id' => 1,'test' => 'test'],['id' => 1,'test' => 'test']]));die; - dump(Db::insert('insert into zq_user id values 1'));die; - dump(Db::table('zq_user')->insert(['id' => 1]));die; - dump(Db::table('zq_user')->field('id')->where('id = 11')->select());die; - dump(Db::table('zq_user')->getLastSql());die; - dump(Db::select('select * from zq_user')); - Application::event( - 'test', - [ - \app\controller\main\Event::class, - \app\controller\main\Event::class, - \app\controller\main\Event::class - ] - ); - Application::event('test'); - Application::router('index/getUser',function(){ - return 1; - }); - dump(Application::config()->getLoadPath()); - Application::middleware('beginMiddleware',function (Closure $v) { - $v(); - echo 3; - return $v; - }); - Application::middleware('beginMiddleware',function (Closure $v) { - $v(); - echo 4; - return $v; - }); - Application::middleware('beginMiddleware',function (Closure $v) { - $v(); - echo 5; - return $v; - }); - Application::middleware('beginMiddleware',function (Closure $v) { - $v(); - echo 6; - return $v; - }); - Application::middleware('beginMiddleware',function (Closure $v) { - $v(); - echo 7; - return $v; - }); - Application::middleware('beginMiddleware');die; -// Application::input('get.in',function($value){ -// //闭包实现 -// //这里写具体的过滤方法 -// //自定义 -// //记得返回处理好的 -// return $value; -// }); -// dump(Application::httpRequest()->isGet()); - } -} \ No newline at end of file diff --git a/src/application/controller/main/Index.php b/src/application/controller/main/Index.php deleted file mode 100644 index b49fe99..0000000 --- a/src/application/controller/main/Index.php +++ /dev/null @@ -1,14 +0,0 @@ - 'json' + ]; + + public function main() + { + $model = model('app/http/model/Home'); + return ['code' => 200, 'msg' => $model->select()->toArray()]; + } + + public function index() + { + return $this->display('http/home/main'); + } + +} \ No newline at end of file diff --git a/src/application/http/model/Home.php b/src/application/http/model/Home.php new file mode 100644 index 0000000..96556d5 --- /dev/null +++ b/src/application/http/model/Home.php @@ -0,0 +1,18 @@ +setErrorView(EXTRA_PATH . 'tpl/error.html') + $error = new Error(); + $error->register( + $error->setErrorView(EXTRA_PATH . 'tpl/error.html') ->setDebug(true) - ->setErrHandle('app\\exception\\exception\\View') + ->setErrHandle('app\\exception\\Handle') )->complete(); app()->containerInstance( 'linkphp\error\Error', - Error::instance() + $error ); return $definition; // TODO: Implement update() method. diff --git a/src/application/provider/RouterProvider.php b/src/application/provider/RouterProvider.php index f3cc7c0..dfb24a4 100644 --- a/src/application/provider/RouterProvider.php +++ b/src/application/provider/RouterProvider.php @@ -4,29 +4,23 @@ use linkphp\event\EventDefinition; use linkphp\event\EventServerProvider; -use linkphp\Exception; -use linkphp\Application; class RouterProvider implements EventServerProvider { public function update(EventDefinition $definition) { - $router = Application::make(\linkphp\router\Router::class); + $router = app()->make(\linkphp\router\Router::class); $router->init() - ->import(require LOAD_PATH . 'route.php') + ->import(require ROOT_PATH . 'src/route.php') ->setUrlModel('1') - ->setDefaultPlatform('main') + ->setDefaultPlatform('http') ->setDefaultController('Home') ->setDefaultAction('main') ->setVarPlatform('m') ->setVarController('c') ->setVarAction('a') ->setRouterOn('true') - ->setPlatform('') - ->setController('') - ->setAction('') - ->setDir(APPLICATION_PATH) ->setNamespace(APP_NAMESPACE_NAME); return $definition; // TODO: Implement update() method. diff --git a/src/application/provider/TemplateProvider.php b/src/application/provider/TemplateProvider.php new file mode 100644 index 0000000..5406156 --- /dev/null +++ b/src/application/provider/TemplateProvider.php @@ -0,0 +1,27 @@ +engine(); + $view->config(require ROOT_PATH . 'conf/view.php') + ->viewPath(CACHE_PATH . 'view/') + ->root('') + ->baseFile(''); + app()->containerInstance( + 'linkphp\template\View', + $view + ); + return $eventDefinition; + } + +} \ No newline at end of file diff --git a/src/application/ws/controller/Handle.php b/src/application/ws/controller/Handle.php new file mode 100644 index 0000000..066e0c7 --- /dev/null +++ b/src/application/ws/controller/Handle.php @@ -0,0 +1,41 @@ +fd}\n"; + } + + public function open(swoole_websocket_server $svr, swoole_http_request $req) + { + echo "server: open success with fd{$req->fd}\n"; + } + + public function message(swoole_server $server, swoole_websocket_frame $frame) + { + echo "receive from {$frame->fd}:{$frame->data},opcode:{$frame->opcode},fin:{$frame->finish}\n"; + $server->push($frame->fd, "this is server"); + } + + public function close($ser, $fd) + { + echo "client {$fd} closed\n"; + } + +} \ No newline at end of file diff --git a/src/bootstrap.php b/src/bootstrap.php index 3223538..057b1e4 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -14,7 +14,7 @@ $loader = new \linkphp\loader\Loader(); -//注册自动加载方法 +//注册自动加载方法/合并conposer $loader->register( $loader->import(require_once(ROOT_PATH . 'conf/map.php')) ->setVendorPath(ROOT_PATH . 'vendor/') @@ -24,14 +24,22 @@ ->setExt('.php') )->complete(); -$app = new \linkphp\Application(); +$app = new \framework\Application(); + +$app->event( + 'loader', + \linkphp\loader\provider\RegisterProvider::class, + true +); $app->event( 'system', [ + \linkphp\event\provider\EnvProvider::class, \linkphp\event\provider\ConfigProvider::class, \linkphp\event\provider\MiddleProvider::class, \linkphp\event\provider\DatabaseProvider::class, + \app\provider\TemplateProvider::class, ] ); @@ -41,7 +49,7 @@ ); $app->containerInstance( - \linkphp\Application::class, + \framework\Application::class, $app ); diff --git a/conf/common.php b/src/common.php similarity index 100% rename from conf/common.php rename to src/common.php diff --git a/src/resource/view/main/home/main.html b/src/resource/view/http/home/main.html similarity index 100% rename from src/resource/view/main/home/main.html rename to src/resource/view/http/home/main.html diff --git a/src/resource/view/ws/chat.html b/src/resource/view/ws/chat.html new file mode 100644 index 0000000..2da8075 --- /dev/null +++ b/src/resource/view/ws/chat.html @@ -0,0 +1,63 @@ + + + + + Websocket + + + +

Websocket

+
+ +
+ +
+
+ 在线人数: + +
+
+ + + +

AltStyle によって変換されたページ (->オリジナル) /

+ + \ No newline at end of file diff --git a/src/route.php b/src/route.php new file mode 100755 index 0000000..cff4f80 --- /dev/null +++ b/src/route.php @@ -0,0 +1,31 @@ +event('routerMiddleware', $event); + +//Router::get('/', function(HttpRequest $httpRequest){ +// view('main/home/main',[ +// 'linkphp' => 'linkphp' +// ]); +//}); + +Router::get(':id/:test', function($id, $test, HttpRequest $httpRequest){ +// dump($id); +// dump($httpRequest); + return "闭包路由,不走实例控制器,直接闭包返回的结果。接收到的参数id:" . $id . ",test:".$test; +}); +Router::ws('chat','/app/ws/Handle#ws'); +//Router::get('addons', '/addons/test/Test@main'); +Router::get('addons/:plugin', '/linkphp/addons/Bootstrap@boot', [], ['plugin' => '/[\s\S]*/']); +Router::get('/', '/http/home/main'); + +return [ +// ':id/:test' => ['/http/home/main',['method' => 'get']], +]; \ No newline at end of file diff --git a/src/runtime/log/2018-06-02.log b/src/runtime/log/2018-06-02.log new file mode 100644 index 0000000..48f97df --- /dev/null +++ b/src/runtime/log/2018-06-02.log @@ -0,0 +1,18 @@ +[2018年06月02日T07:45:43+00:00] +run NOTICE: +message: Use of undefined constant g - assumed 'g' +file: /Users/liujun/workspace/php/linkphp/src/application/controller/main/Home.php +line: 20 + +[2018年06月02日T07:45:43+00:00] +run Exception: +message: 无法加载模块 +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 30 + +[2018年06月02日T07:46:15+00:00] +run Exception: +message: 无法加载模块 +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 30 + diff --git a/src/runtime/log/2018-06-07.log b/src/runtime/log/2018-06-07.log new file mode 100644 index 0000000..9516739 --- /dev/null +++ b/src/runtime/log/2018-06-07.log @@ -0,0 +1,324 @@ +[2018年06月07日T10:10:34+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:30 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 30 + +[2018年06月07日T10:19:26+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T10:20:52+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T10:22:52+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T10:23:39+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T10:24:20+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T11:02:23+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T11:07:36+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T11:08:09+00:00] +run NOTICE: +message: Undefined index: default_theme_suffix +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/config/src/Config.php +line: 127 + +[2018年06月07日T11:08:09+00:00] +run WARNING: +message: file_get_contents(/Users/liujun/workspace/php/linkphp/src/resource/view/main/home/main): failed to open stream: No such file or directory +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/template/src/view/engine/Link.php +line: 49 + +[2018年06月07日T11:08:09+00:00] +run NOTICE: +message: Undefined index: set_left_limiter +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/config/src/Config.php +line: 127 + +[2018年06月07日T11:08:09+00:00] +run NOTICE: +message: Undefined index: set_right_limiter +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/config/src/Config.php +line: 127 + +[2018年06月07日T11:08:09+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T11:08:17+00:00] +run NOTICE: +message: Undefined index: default_theme_suffix +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/config/src/Config.php +line: 127 + +[2018年06月07日T11:08:17+00:00] +run WARNING: +message: file_get_contents(/Users/liujun/workspace/php/linkphp/src/resource/view/main/home/main): failed to open stream: No such file or directory +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/template/src/view/engine/Link.php +line: 49 + +[2018年06月07日T11:08:17+00:00] +run NOTICE: +message: Undefined index: set_left_limiter +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/config/src/Config.php +line: 127 + +[2018年06月07日T11:08:17+00:00] +run NOTICE: +message: Undefined index: set_right_limiter +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/config/src/Config.php +line: 127 + +[2018年06月07日T11:08:17+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T11:10:21+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T11:10:56+00:00] +run Fatal Error: +message: Uncaught Exception: 无法加载模块 in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Router.php(138): linkphp\router\Dispatch->dispatch(Object(linkphp\router\Router)) +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(79): linkphp\router\Router->dispatch() +#2 [internal function]: linkphp\swoole\http\HttpdServer->linkphp\swoole\http\{closure}() +#3 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/linkphp/Kernel.php(32): call_user_func(Object(Closure)) +#4 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php(85): linkphp\Kernel->then(Object(Closure)) +#5 {main} + thrown +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Dispatch.php +line: 31 + +[2018年06月07日T11:22:44+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 61 + +[2018年06月07日T11:22:44+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 61 + +[2018年06月07日T11:24:51+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 61 + +[2018年06月07日T11:24:51+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 61 + +[2018年06月07日T11:25:28+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 48 + +[2018年06月07日T11:25:28+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 62 + +[2018年06月07日T11:25:28+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 48 + +[2018年06月07日T11:25:28+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 62 + +[2018年06月07日T11:26:10+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 62 + +[2018年06月07日T11:26:10+00:00] +run NOTICE: +message: Undefined index: query_uri +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 62 + +[2018年06月07日T11:30:00+00:00] +run WARNING: +message: Swoole\Http\Response::status(): Http request is finished. +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 87 + +[2018年06月07日T11:30:00+00:00] +run WARNING: +message: Swoole\Http\Response::end(): Http request is finished. +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 88 + +[2018年06月07日T11:35:58+00:00] +run WARNING: +message: Swoole\Http\Response::status(): Http request is finished. +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 83 + +[2018年06月07日T11:35:58+00:00] +run WARNING: +message: Swoole\Http\Response::end(): Http request is finished. +file: /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/http/HttpdServer.php +line: 84 + +[2018年06月07日T11:49:45+00:00] +run NOTICE: +message: Use of undefined constant d - assumed 'd' +file: /Users/liujun/workspace/php/linkphp/src/application/controller/main/Home.php +line: 23 + +[2018年06月07日T11:51:39+00:00] +run NOTICE: +message: Use of undefined constant d - assumed 'd' +file: /Users/liujun/workspace/php/linkphp/src/application/controller/main/Home.php +line: 23 + +[2018年06月07日T11:52:21+00:00] +run NOTICE: +message: Use of undefined constant d - assumed 'd' +file: /Users/liujun/workspace/php/linkphp/src/application/controller/main/Home.php +line: 23 + +[2018年06月07日T11:53:42+00:00] +run NOTICE: +message: Use of undefined constant d - assumed 'd' +file: /Users/liujun/workspace/php/linkphp/src/application/controller/main/Home.php +line: 23 + diff --git a/src/runtime/log/link-httpd.log b/src/runtime/log/link-httpd.log new file mode 100644 index 0000000..61beae9 --- /dev/null +++ b/src/runtime/log/link-httpd.log @@ -0,0 +1,4 @@ +[2018年06月20日 19:35:59 #52069.1] NOTICE Server is shutdown now. +[2018年06月20日 20:17:59 #52141.1] NOTICE Server is shutdown now. +[2018年06月22日 00:52:06 #53777.1] NOTICE Server is shutdown now. +[2018年06月22日 12:01:22 #54299.1] NOTICE Server is shutdown now. diff --git a/src/runtime/log/ws.log b/src/runtime/log/ws.log new file mode 100644 index 0000000..2be2d6a --- /dev/null +++ b/src/runtime/log/ws.log @@ -0,0 +1,304 @@ +[2018年06月24日 18:49:11 *57831.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 18:50:12 #57829.1] NOTICE Server is shutdown now. +[2018年06月24日 18:50:24 *57847.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 18:50:41 #57845.1] NOTICE Server is shutdown now. +[2018年06月24日 18:54:12 *57870.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 18:54:22 #57868.1] NOTICE Server is shutdown now. +[2018年06月24日 18:54:45 *57887.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 18:55:22 #57885.1] NOTICE Server is shutdown now. +[2018年06月24日 18:55:27 *57900.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 18:59:24 #57898.1] NOTICE Server is shutdown now. +[2018年06月24日 18:59:27 *57914.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:00:19 #57912.1] NOTICE Server is shutdown now. +[2018年06月24日 19:00:26 *57930.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught TypeError: Argument 2 passed to linkphp\router\Parser::match() must be of the type array, null given, called in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php on line 166 and defined in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php:26 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php(166): linkphp\router\Parser->match('chat', NULL, Array) +#1 /Users/liujun/works +[2018年06月24日 19:00:26 57929ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 19:01:09 #57928.1] NOTICE Server is shutdown now. +[2018年06月24日 19:01:13 *57942.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught TypeError: Argument 2 passed to linkphp\router\Parser::match() must be of the type array, null given, called in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php on line 166 and defined in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php:26 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php(166): linkphp\router\Parser->match('chat', NULL, Array) +#1 /Users/liujun/works +[2018年06月24日 19:01:13 57941ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 19:02:01 #57940.1] NOTICE Server is shutdown now. +[2018年06月24日 19:02:16 *57954.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught TypeError: Argument 2 passed to linkphp\router\Parser::match() must be of the type array, null given, called in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php on line 167 and defined in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php:26 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php(167): linkphp\router\Parser->match('chat', NULL, Array) +#1 /Users/liujun/works +[2018年06月24日 19:02:16 57953ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 19:02:32 #57952.1] NOTICE Server is shutdown now. +[2018年06月24日 19:05:20 *57978.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:06:41 #57976.1] NOTICE Server is shutdown now. +[2018年06月24日 19:06:47 *57991.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught TypeError: Argument 2 passed to linkphp\router\Parser::match() must be of the type array, null given, called in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php on line 166 and defined in /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php:26 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php(166): linkphp\router\Parser->match('chat', NULL, Array) +#1 /Users/liujun/works +[2018年06月24日 19:06:47 57990ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 19:10:45 #57989.1] NOTICE Server is shutdown now. +[2018年06月24日 19:10:50 *58007.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:12:43 #58004.1] NOTICE Server is shutdown now. +[2018年06月24日 19:12:47 *58026.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:13:22 #58024.1] NOTICE Server is shutdown now. +[2018年06月24日 19:13:26 *58038.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:14:06 #58036.1] NOTICE Server is shutdown now. +[2018年06月24日 19:14:11 *58053.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:14:51 #58051.1] NOTICE Server is shutdown now. +[2018年06月24日 19:14:54 *58063.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:15:09 #58061.1] NOTICE Server is shutdown now. +[2018年06月24日 19:15:13 *58075.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:16:16 #58073.1] NOTICE Server is shutdown now. +[2018年06月24日 19:16:20 *58088.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:16:29 #58086.1] NOTICE Server is shutdown now. +[2018年06月24日 19:21:04 *58102.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:21:45 #58100.1] NOTICE Server is shutdown now. +[2018年06月24日 19:21:50 *58115.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 19:21:57 #58113.1] NOTICE Server is shutdown now. +[2018年06月24日 20:01:43 #58164.1] NOTICE Server is shutdown now. +[2018年06月24日 20:02:23 #58177.1] NOTICE Server is shutdown now. +[2018年06月24日 20:02:35 #58186.1] NOTICE Server is shutdown now. +[2018年06月24日 20:06:22 #58199.1] NOTICE Server is shutdown now. +[2018年06月24日 20:36:23 #58220.1] NOTICE Server is shutdown now. +[2018年06月24日 20:40:55 #58273.1] NOTICE Server is shutdown now. +[2018年06月24日 20:44:54 #58289.1] NOTICE Server is shutdown now. +[2018年06月24日 20:50:17 *58311.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function open() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:52 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 52. +[2018年06月24日 20:50:17 58310ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 20:50:17 *58312.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function message() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:60 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 60. +[2018年06月24日 20:50:17 58310ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 20:50:20 *58313.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function message() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:60 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 60. +[2018年06月24日 20:50:20 58310ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 20:50:21 *58314.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function message() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:60 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 60. +[2018年06月24日 20:50:21 58310ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 20:50:25 #58309.1] NOTICE Server is shutdown now. +[2018年06月24日 20:51:01 #58325.1] NOTICE Server is shutdown now. +[2018年06月24日 20:54:57 #58339.1] NOTICE Server is shutdown now. +[2018年06月24日 20:57:29 #58353.1] NOTICE Server is shutdown now. +[2018年06月24日 21:57:10 #58423.1] NOTICE Server is shutdown now. +[2018年06月24日 21:58:14 #58437.1] NOTICE Server is shutdown now. +[2018年06月24日 21:58:26 #58451.1] NOTICE Server is shutdown now. +[2018年06月24日 22:00:31 *58478.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function HandShake() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:27 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 27. +[2018年06月24日 22:00:31 58477ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 22:00:55 #58476.1] NOTICE Server is shutdown now. +[2018年06月24日 22:01:56 #58489.1] NOTICE Server is shutdown now. +[2018年06月24日 22:06:34 #58509.1] NOTICE Server is shutdown now. +[2018年06月24日 22:06:39 *58531.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function message() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:94 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 94. +[2018年06月24日 22:06:39 58529ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 22:09:02 #58528.1] NOTICE Server is shutdown now. +[2018年06月24日 22:09:08 *58546.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:09:16 #58543.1] NOTICE Server is shutdown now. +[2018年06月24日 22:18:59 *58578.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function message() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:95 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 95. +[2018年06月24日 22:18:59 58576ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 22:19:15 #58575.1] NOTICE Server is shutdown now. +[2018年06月24日 22:19:30 *58592.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:20:14 #58589.1] NOTICE Server is shutdown now. +[2018年06月24日 22:20:20 *58606.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:21:59 #58603.1] NOTICE Server is shutdown now. +[2018年06月24日 22:22:03 *58620.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function HandShake() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:93 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 93. +[2018年06月24日 22:22:03 58619ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 22:32:02 #58618.1] NOTICE Server is shutdown now. +[2018年06月24日 22:34:41 *58661.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:36:51 #58658.1] NOTICE Server is shutdown now. +[2018年06月24日 22:36:57 *58681.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:37:46 #58678.1] NOTICE Server is shutdown now. +[2018年06月24日 22:37:50 *58695.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:39:47 #58692.1] NOTICE Server is shutdown now. +[2018年06月24日 22:39:55 *58711.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:47:16 #58708.1] NOTICE Server is shutdown now. +[2018年06月24日 22:47:23 *58745.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:47:32 #58742.1] NOTICE Server is shutdown now. +[2018年06月24日 22:49:01 *58770.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月24日 22:49:06 #58767.1] NOTICE Server is shutdown now. +[2018年06月24日 22:51:08 *58789.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught TypeError: Argument 1 passed to linkphp\swoole\websocket\WebSocketServer::linkphp\swoole\websocket\{closure}() must be an instance of Swoole\Http\Request, instance of Swoole\WebSocket\Server given in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:92 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 92. +[2018年06月24日 22:51:08 58787ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 22:52:10 #58786.1] NOTICE Server is shutdown now. +[2018年06月24日 22:52:14 *58805.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught ArgumentCountError: Too few arguments to function linkphp\swoole\websocket\WebSocketServer::linkphp\swoole\websocket\{closure}(), 2 passed and exactly 3 expected in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:92 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 92. +[2018年06月24日 22:52:14 58803ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月24日 22:52:22 #58802.1] NOTICE Server is shutdown now. +[2018年06月24日 22:54:04 *58837.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 15:12:16 #58834.1] NOTICE Server is shutdown now. +[2018年06月25日 15:12:27 *59541.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function message() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:94 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 94. +[2018年06月25日 15:12:27 59539ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月25日 15:12:45 #59538.1] NOTICE Server is shutdown now. +[2018年06月25日 15:13:42 *59557.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 15:13:57 #59554.1] NOTICE Server is shutdown now. +[2018年06月25日 15:55:33 *59649.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 15:56:00 #59647.1] NOTICE Server is shutdown now. +[2018年06月25日 15:56:06 *59663.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:20:19 #59660.1] NOTICE Server is shutdown now. +[2018年06月25日 16:22:49 *59734.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:23:16 #59731.1] NOTICE Server is shutdown now. +[2018年06月25日 16:28:57 59777ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月25日 16:32:12 #59776.1] NOTICE Server is shutdown now. +[2018年06月25日 16:32:18 *59801.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function HandShake() on boolean in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:73 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 73. +[2018年06月25日 16:32:18 59800ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月25日 16:32:51 #59799.1] NOTICE Server is shutdown now. +[2018年06月25日 16:45:29 *59836.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:49:27 #59833.1] NOTICE Server is shutdown now. +[2018年06月25日 16:49:34 *59857.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:50:11 *59861.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:51:50 #59854.1] NOTICE Server is shutdown now. +[2018年06月25日 16:57:44 #59874.1] NOTICE Server is shutdown now. +[2018年06月25日 16:57:54 *59910.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught TypeError: Argument 1 passed to app\ws\controller\Handle::HandShake() must be an instance of Swoole\Http\Request, instance of Swoole\WebSocket\Server given, called in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 94 and defined in /Users/liujun/workspace/php/linkphp/src/application/ws/controller/Handle.php:20 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/We +[2018年06月25日 16:57:54 59909ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月25日 16:58:19 #59908.1] NOTICE Server is shutdown now. +[2018年06月25日 16:58:46 *59927.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:58:54 #59924.1] NOTICE Server is shutdown now. +[2018年06月25日 16:59:16 *59942.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:59:22 #59939.1] NOTICE Server is shutdown now. +[2018年06月25日 16:59:54 *59955.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 16:59:59 #59952.1] NOTICE Server is shutdown now. +[2018年06月25日 17:18:56 *59994.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 17:20:50 #59990.1] NOTICE Server is shutdown now. +[2018年06月25日 17:21:15 *60009.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 17:22:05 #60006.1] NOTICE Server is shutdown now. +[2018年06月25日 17:22:14 *60022.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 17:34:05 #60019.1] NOTICE Server is shutdown now. +[2018年06月25日 17:34:14 *60057.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to a member function rewind() on null in /Users/liujun/workspace/php/linkphp/vendor/linkphp/event/src/Event.php:69 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/framework/src/Application.php(245): linkphp\event\Event->target('routerMiddlewar...') +#1 /Users/liujun/workspace/php/linkphp/vendor/linkphp/router/src/Parser.php(92): framework\Application::event('routerMiddlewar...') +#2 /Users/liujun/workspace/php/linkphp/vend +[2018年06月25日 17:34:14 60055ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月25日 17:34:34 #60054.1] NOTICE Server is shutdown now. +[2018年06月25日 23:30:33 #60069.1] NOTICE Server is shutdown now. +[2018年06月25日 23:30:52 *60367.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:31:36 #60364.1] NOTICE Server is shutdown now. +[2018年06月25日 23:32:13 *60387.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:32:33 #60384.1] NOTICE Server is shutdown now. +[2018年06月25日 23:32:39 *60403.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:32:40 *60404.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:32:55 #60400.1] NOTICE Server is shutdown now. +[2018年06月25日 23:37:08 *60430.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:37:50 #60427.1] NOTICE Server is shutdown now. +[2018年06月25日 23:38:06 *60447.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:38:41 #60444.1] NOTICE Server is shutdown now. +[2018年06月25日 23:38:46 *60463.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:40:05 #60460.1] NOTICE Server is shutdown now. +[2018年06月25日 23:40:12 *60477.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:40:41 #60474.1] NOTICE Server is shutdown now. +[2018年06月25日 23:42:09 *60497.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月25日 23:43:28 #60494.1] NOTICE Server is shutdown now. +[2018年06月26日 00:17:07 *60565.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月26日 16:13:20 #60562.1] NOTICE Server is shutdown now. +[2018年06月26日 16:13:37 *61363.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月26日 16:16:32 #61360.1] NOTICE Server is shutdown now. +[2018年06月26日 16:17:31 *61395.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月26日 16:17:37 #61392.1] NOTICE Server is shutdown now. +[2018年06月26日 16:36:24 *61429.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Call to undefined method linkphp\swoole\websocket\WebSocketContext::context() in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:75 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 75. +[2018年06月26日 16:36:24 61428ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月26日 16:39:09 #61427.1] NOTICE Server is shutdown now. +[2018年06月26日 16:42:01 #61445.1] NOTICE Server is shutdown now. +[2018年06月26日 16:45:04 #61462.1] NOTICE Server is shutdown now. +[2018年06月26日 16:45:29 #61478.1] NOTICE Server is shutdown now. +[2018年06月26日 16:46:33 #61492.1] NOTICE Server is shutdown now. +[2018年06月26日 16:47:23 #61504.1] NOTICE Server is shutdown now. +[2018年06月26日 16:48:44 #61520.1] NOTICE Server is shutdown now. +[2018年06月26日 16:48:57 #61537.1] NOTICE Server is shutdown now. +[2018年06月26日 16:49:39 #61550.1] NOTICE Server is shutdown now. +[2018年06月26日 17:11:20 *61598.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月26日 17:12:18 #61595.1] NOTICE Server is shutdown now. +[2018年06月26日 17:12:25 *61613.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月26日 17:12:34 #61610.1] NOTICE Server is shutdown now. +[2018年06月26日 17:12:54 *61629.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月26日 17:15:48 #61625.1] NOTICE Server is shutdown now. +[2018年06月26日 17:16:10 *61647.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Undefined class constant 'getContext' in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketContext.php:42 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php(125): linkphp\swoole\websocket\WebSocketContext::get(1, 'meta') +#1 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketContext.php on line 42. +[2018年06月26日 17:16:10 61645ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月26日 17:16:25 #61644.1] NOTICE Server is shutdown now. +[2018年06月26日 17:16:42 *61663.0] NOTICE zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die(). +[2018年06月26日 17:17:40 #61660.1] NOTICE Server is shutdown now. +[2018年06月26日 18:16:35 *61838.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught ArgumentCountError: Too few arguments to function linkphp\swoole\websocket\Dispatcher::handshake(), 0 passed in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 61 and exactly 2 expected in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/Dispatcher.php:31 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php(61): linkphp\swo +[2018年06月26日 18:16:35 61837ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月26日 18:16:54 #61836.1] NOTICE Server is shutdown now. +[2018年06月26日 18:18:17 *61852.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught framework\Exception in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/Dispatcher.php:42 +Stack trace: +#0 /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php(61): linkphp\swoole\websocket\Dispatcher->handshake(Object(Swoole\Http\Request), Object(Swoole\Http\Response)) +#1 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/Dispatcher.php on line 42. +[2018年06月26日 18:18:17 61851ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月26日 18:18:56 #61850.1] NOTICE Server is shutdown now. +[2018年06月26日 18:19:21 #61872.1] NOTICE Server is shutdown now. +[2018年06月26日 18:20:17 #61889.1] NOTICE Server is shutdown now. +[2018年06月26日 18:21:25 #61907.1] NOTICE Server is shutdown now. +[2018年06月26日 18:29:39 #61922.1] NOTICE Server is shutdown now. +[2018年06月26日 19:01:22 #61945.1] NOTICE Server is shutdown now. +[2018年06月26日 19:01:50 #62026.1] NOTICE Server is shutdown now. +[2018年06月26日 19:03:16 #62042.1] NOTICE Server is shutdown now. +[2018年06月26日 19:40:13 #62061.1] NOTICE Server is shutdown now. +[2018年06月26日 19:40:20 62192ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:41:03 #62191.1] NOTICE Server is shutdown now. +[2018年06月26日 19:41:12 *62205.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Uncaught Error: Access to undeclared static property: linkphp\swoole\websocket\WebSocketServer::$fds in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php:36 +Stack trace: +#0 {main} + thrown in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 36. +[2018年06月26日 19:41:12 62204ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月26日 19:41:26 #62203.1] NOTICE Server is shutdown now. +[2018年06月26日 19:41:38 62219ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:41:45 #62218.1] NOTICE Server is shutdown now. +[2018年06月26日 19:42:27 62237ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:42:31 #62236.1] NOTICE Server is shutdown now. +[2018年06月26日 19:42:55 62249ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:42:59 #62248.1] NOTICE Server is shutdown now. +[2018年06月26日 19:43:21 62262ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:43:29 #62261.1] NOTICE Server is shutdown now. +[2018年06月26日 19:44:08 62278ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:44:12 #62277.1] NOTICE Server is shutdown now. +[2018年06月26日 19:44:23 62291ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:44:28 #62290.1] NOTICE Server is shutdown now. +[2018年06月26日 19:45:05 62307ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 19:45:10 #62306.1] NOTICE Server is shutdown now. +[2018年06月26日 19:45:30 #62323.1] NOTICE Server is shutdown now. +[2018年06月26日 19:47:25 *62352.0] ERROR zm_deactivate_swoole (ERROR 503): Fatal error: Swoole\Table::set(): the swoole table does not exist. in /Users/liujun/workspace/php/linkphp/vendor/linkphp/swoole/src/websocket/WebSocketServer.php on line 37. +[2018年06月26日 19:47:25 62351ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=255, signal=0 +[2018年06月26日 20:13:19 #62350.1] NOTICE Server is shutdown now. +[2018年06月26日 20:13:33 62465ドル.0] WARNING swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11 +[2018年06月26日 20:13:54 #62464.1] NOTICE Server is shutdown now. +[2018年06月26日 20:19:20 #62488.1] NOTICE Server is shutdown now. +[2018年06月26日 20:20:00 #62504.1] NOTICE Server is shutdown now. +[2018年06月26日 20:25:09 #62528.1] NOTICE Server is shutdown now. diff --git a/src/runtime/temp/temp_c/6ed681c687cefbc5ee108f320eee1f65.c.php b/src/runtime/temp/temp_c/6ed681c687cefbc5ee108f320eee1f65.c.php deleted file mode 100644 index 959fd79..0000000 --- a/src/runtime/temp/temp_c/6ed681c687cefbc5ee108f320eee1f65.c.php +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - <?php echo $linkphp; ?> - - - - -
-
- - \ No newline at end of file diff --git a/src/runtime/temp/temp_c/7103d428727f75b257e4e8f21b673bfc.c.php b/src/runtime/temp/temp_c/7103d428727f75b257e4e8f21b673bfc.c.php index 959fd79..d754fd7 100644 --- a/src/runtime/temp/temp_c/7103d428727f75b257e4e8f21b673bfc.c.php +++ b/src/runtime/temp/temp_c/7103d428727f75b257e4e8f21b673bfc.c.php @@ -1,17 +1,13 @@ + - - - - <?php echo $linkphp; ?> + BananaChat - -
-
+BananaChat \ No newline at end of file diff --git a/src/runtime/temp/temp_c/8488f1b8fa698b4a0857d8ffce7aee70.c.php b/src/runtime/temp/temp_c/8488f1b8fa698b4a0857d8ffce7aee70.c.php new file mode 100644 index 0000000..f39ca70 --- /dev/null +++ b/src/runtime/temp/temp_c/8488f1b8fa698b4a0857d8ffce7aee70.c.php @@ -0,0 +1,64 @@ + + + + + + Websocket + + + + +
+ +
+ +
+
+ 在线人数: + +
+
+ + + + + + \ No newline at end of file diff --git a/src/runtime/temp/temp_cache/098f6bcd4621d373cade4e832627b4f6.php b/src/runtime/temp/temp_cache/098f6bcd4621d373cade4e832627b4f6.php index 815286c..2967e1e 100644 --- a/src/runtime/temp/temp_cache/098f6bcd4621d373cade4e832627b4f6.php +++ b/src/runtime/temp/temp_cache/098f6bcd4621d373cade4e832627b4f6.php @@ -1 +1,4 @@ -s:4:"test"; \ No newline at end of file + +test \ No newline at end of file diff --git a/src/web/index.php b/src/web/index.php index 4825f69..b600056 100755 --- a/src/web/index.php +++ b/src/web/index.php @@ -31,7 +31,7 @@ $kernel = $app->make(app\Kernel::class); -$kernel->use() +$kernel->start() ->then(function () use ($kernel,$app){ $kernel->setData($app->make(linkphp\router\Router::class) ->getReturnData()); diff --git a/swoole-ide-helper.phar b/swoole-ide-helper.phar new file mode 100644 index 0000000..a22c22b Binary files /dev/null and b/swoole-ide-helper.phar differ