Coder Social home page Coder Social logo

ssf's Introduction

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

ssf's People

Contributors

sn01615 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

wanyanshaofeng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.