1 Star 1 Fork 0

杨龙 / ssf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ssf

Simple swoole framework

install

composer create-project sn01615/ssf youname dev-main

Run

php index.php

Nginx config

server {
    ...

    location / {
        try_files $uri /sw_proxy_pass;
    }

    location /sw_proxy_pass {
        proxy_http_version 1.1;
        proxy_set_header Connection "keep-alive";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:9501$request_uri;
    }

    ...
}

Database: Query Builder

Model的 mtb 和 tb 属性都是 Illuminate\Database\Eloquent\Builder 实例, 不同的是mtb是使用主库,tb可能查询的从库

查询数据

$result = $this->mtb->where('id', $id)->limit(1)->get()->toArray();

直接运行SQL(使用db属性的select等方法)

$result = $this->db->select("select * from user where id = 1 limit 1");

插入数据可以使用iInsert方法

$newId = $this->iInsert([
    'name' => 123,
]);

update数据

$affected = $this->mtb->where('id', 1)->update([
    'name' => '哈哈',
]);

Model命名说明 TestModel会映射到testUserModel会映射到userXxCccModel会映射到xx_ccc表,驼峰会转成下划线

参考

数据库 laravel database语法参考 https://laravel.com/docs/5.8/database

模板引擎 twig语法参考 https://twig.symfony.com/doc/2.x

使用交流

群号码:21890295

论坛:https://www.qingwx.com/category/7

MIT License Copyright (c) 2020 YangLong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个简单的基于swoole http、fastrouter PHP框架,适合写api,也集成了模板引擎,代码结构简单,路由数据库模板引擎都有,极易学习和改造,是自己造轮子的好选择,不需要费力研究文档即可上手使用! 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/sn01615/ssf.git
git@gitee.com:sn01615/ssf.git
sn01615
ssf
ssf
main

搜索帮助