代码拉取完成,页面将自动刷新
瞎写的,自己用的
瞎几吧乱抄的, 依赖以下扩展
phpredis
swoole
inotify
新建 $dir/composer.json
新建 $dir/app/controller
新建 $dir/app/model
新建 $dir/app/middleware
新建 $dir/commands
新建 $dir/components
新建 $dir/config
新建 $dir/routes
添加composer 内容
{
"autoload": {
"psr-4": {
"App\\": "app"
},
"files": [
]
},
"require": {
"php": ">= 7.1",
},
"require-dev": {
"forset/forset": "dev-master",
"swoole/ide-helper": "@dev"
}
}
执行 composer update
新建 $dir/routes/web.php
<?php
use BeReborn\Route\Router;
/** @var Router $router */
$router->get('index', 'SiteController@index');
$router->post('index', 'SiteController@index');
$router->any('index', 'SiteController@index');
$router->delete('index', 'SiteController@index');
$router->put('index', 'SiteController@index');
$options = [
'prefix' => '', //前缀
'namespace' => '', //Controller使用的命名空间如 namespace='server'则访问 app\controller\server\TestController
'filter' => [ // 过滤请求用的, 参数效验同 model写法
'grant' => [] , //权限效验回调函数
'header' => [ //效验请求头所需数据
[['token', 'user', 'time', 'source'], 'required'],
[['token', 'source'], 'string'],
[['user', 'time'], 'int', 'maxLength' => 32],
],
'body' => [ //效验请求体所需数据
[['token', 'user', 'time', 'source'], 'required'],
[['token', 'source'], 'string'],
[['user', 'time'], 'int', 'maxLength' => 32],
]
],
'middleware' => '', // 中间件
'options' => '', // ajax跨域请求处理
];
$router->group($options, function (\BeReborn\Route\Router $router){
$router->get('index', 'SiteController@index');
$router->post('index', 'SiteController@index');
$router->any('index', 'SiteController@index');
$router->delete('index', 'SiteController@index');
$router->put('index', 'SiteController@index');
});
新建 $dir/execfile并添加内容
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('APP_PATH', __DIR__);
define('DISPLAY_ERRORS', TRUE);
define('DEBUG', TRUE);
define('DB_EMPTY', 3001);
define('DB_ERROR', 3002);
define('PARAM_NOT_EXISTS', 4001);
define('PARAM_EMPTY', 4004);
//ini_set('memory_limit','8192M');
use BeReborn\Web\Application;
require_once __DIR__ . '/vendor/autoload.php';
$config = require_once __DIR__ . '/config/configure.php';
$application = new Application($config);
$snooze = $application->getSwooleServer($argv);
if (!$snooze) {
return;
}
$snooze->start();
添加配置项内容 $dir/config/configure.php
<?php
启动 php $dir/execfile 或 php $dir/execfile start
重启 php $dir/execfile restart
停止 php $dir/execfile stop
#Command 注册命令
<?php
use BeReborn\Console\Command;
use BeReborn\Console\Dtl;
class exranpk extends Command{
public $command = 'exmple:test';
public $description = '任务描述';
public $dataFile = '/usr/local/config.json';
public $dataType = 'json';
public function handler(Dtl $dtl)
{
}
}
使用
php artisan command_name --key=o --key=b --key=v
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。