代码拉取完成,页面将自动刷新
同步操作将从 myDcool/CornerPHP 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Summer PHP Framework
|-- core 框架的核心类
|-- config 配置文件
|-- libs 第三方库
|-- model 模型类, 理论上用于写获取数据的具体逻辑, 只放置在根目录下, 任何控制器都可以调用到
|-- modules 项目模块
|-- view 视图文件
|-- tool 框架自带的登录注册模块的SQL,数据库配置文件样例,windows启动php-cgi的脚本
|-- update 框架自更新脚本
|-- static 静态文件存放
|-- cli.php 命令行下的入口文件 php cli.php -q m/c/a/
`-- index.php 入口文件
server {
listen 80;
server_name www.test.com;
location ~ \.ico|jpg|gif|png|js|css|woff2$ {
root E:/php/code/project/static;
#expires 1h;
}
location / {
root E:/php/code/project;
fastcgi_pass 127.0.0.1:9720;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
}
}
127.0.0.1 www.test.com
MYSQL_HOST_FILE
值为dbConfig.json的文件路径所有对外可访问的接口都要在 config/Routeconfig.php中配置映射规则, 接口与真正的方法是映射关系, 不直接暴露源代码的方法名
例如: 获取文章列表的第二页接口的映射规则为
['article_list_(\d+)' => 'index/index/route/page/$1']
那么浏览器中应该这样访问
http://www.test.com/article_list_2
如果浏览器中只输入域名,没有URI,框架会找到 modules/index/index.php::index() 方法并执行
注: 可通过配置文件, 细化的对每个方法的每个数据进行检查, 并提供基本的数据校验方法
Request::Get('a', 'default');
Request::Post('a');
Request::Cookie('a');
Request::Route('a');
Request::isPost();
Request::getClientIp();
...
$a = ['list' => [1,2,3,4]];
输出固定格式的json数据
Response::json(10000, '用户列表', $a);
结果: {"code":10000,"msg":"\u7528\u6237\u5217\u8868","data":{"list":[1,2,3,4]}}
Response::json()的简写, 结构是一样的
Response::success($a);
Response::success($a, '用户列表');
Response::success($a, '用户列表', 20000);
Response::error('参数错误');
结果: {"code":"-1","msg":"\u53c2\u6570\u9519\u8bef","data":[]]}
Response::error('参数错误', $a);
结果: {"code":"-1","msg":"\u53c2\u6570\u9519\u8bef","data":{"list":[1,2,3,4]},"url":""}
Response::error('参数错误', $a, 20001);
结果: {"code":2001,"msg":"\u53c2\u6570\u9519\u8bef","data":{"list":[1,2,3,4]}}
返回任意结构的json数据
Response::jsonReturn($a); //{"list":[1,2,3,4]}
Response::notify('页面找不到啦~'); //页面找不到啦~
Response::redirect('充值成功, 页面即将跳转', 'http://www.hearu.top', 3);
Response::jump('http://www.hearu.top'); //直接跳转
View::display(); //显示单个页面
View::render(); //插入式显示页面(一个HTML页面框架, 里边有占位符:{{xxx}})
更多增删改查操作请查看 modules/index/index.php::sql()
$rs = Test::link('note')->fields('id,content')
->where(['uid' => 1, 'age' => 20])
->whereOp('id', '>', 1)
->order('id desc')
->limit(10)
->select()
->getAll();
echo '<pre>';var_dump($rs, Test::$currentSql);
FileLog::ini(['summer', 'test'], 'test')->info('哈哈哈哈');//文件名为 summer/test/test.log
FileLog::ini(['summer', 'test'])->info([]);// 文件名为 summer/test/yyyy-mm-dd.log, 日志内容会被转为json
基础类在: Libs/IRedis.php 队列名的配置在: config/RedisConfig.php 参考: modules/cli/queue.php
//其中参数Json: _callback是保留字段, 用于回调, 回调的处理类在RedisConfig.php中配置
//如果没有这个字段, 则不会回调
IRedis::pushQueue(redisKey, Json)
// 某一个队列, 如果没有启动过, 才会启动一个新的进程, 内部是 while true
CLI: php cli.php -q queue_blockpop_{$queue_name}
// 多个队列(推荐), 如果没有启动过, 才会启动一个新的进程, 内部是 while true
CLI: php cli.php -q queue_blockpop_all
// 需要在cli下配合crontab或者supervisor使用
// 某个队列 crontab
* * * * * cd path/to/code && php cli.php -q queue_blockpop_{$queue_name}
// 多个队列 (推荐) crontab, 其中 queue_brpop_all 在路由中配置
* * * * * cd path/to/code && php cli.php -q queue_brpop_all
CLI: php cli.php -q queue_restart_{redisKey}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。