GithubHelp home page GithubHelp logo

vitamin-framework-php's Introduction

Vitamin框架之PHP

Php版本的Vitamin其实是一个语法糖,并没有抽象出MVC的架构

部署

部署php请修改gulpfile.js

mysql操作封装

src/utils/sql.php

logger日志操作封装

src/utils/logger.php

request http&https请求操作封装

src/utils/request.php

util 其他操作封装

src/utils/util.php

test.php 页输出

<?php
    require_once dirname(__FILE__).'/config/config.php';
    require_once dirname(__FILE__).'/utils/sql.php';
    require_once dirname(__FILE__).'/utils/logger.php';
    
    Logger::log("普通信息打印!");
    Logger::info("成功信息打印!");
    Logger::error("错误信息打印!");
    Logger::line();
    //操作一次后就关闭数据库连接推荐用法
    SQL::addOnce('user',array(
        "account"=>'test',
        "password"=>'test',
        "nickname"=>'test',
        "logindate"=>date_create()->format('Y-m-d H:i:s')
     ))?Logger::info('Add Success!'):Logger::error('Add Fail!');
    SQL::delOnce('user',"account",'test')?Logger::info('Delete Success!'):Logger::error('Delete Fail!');
    //通常只有调试情况下才需要打开
    Logger::log(SQL::format(SQL::whereOnce('user')));
    

    //连接一次后需要对数据库多次操作,推荐以下用法可以减少数据库连接
    if(SQL::connect()){
        SQL::add('user',array(
            "account"=>'test',
            "password"=>'test',
            "nickname"=>'test',
            "logindate"=>date_create()->format('Y-m-d H:i:s')
        ))?Logger::info('Add Success!'):Logger::error('Add Fail!');

        SQL::update('user',"logindate",date_create()->format('Y-m-d H:i:s'),'account','test1')?Logger::info('Update Success!'):Logger::error('Update Fail!');;

        Logger::log(SQL::format(SQL::where('user')));

        SQL::close();  
    }

[LOG] 普通信息打印!
[INFO] 成功信息打印!
[ERROR] 错误信息打印!


[INFO] Add Success!
[INFO] Delete Success!
[LOG]
  • 1
  • test1
  • 123456
  • someone
  • 2020-03-31 20:30:54

  • 19
  • 123
  • test
  • test
  • 2020-03-31 19:19:05

    [INFO] Add Success!
    [INFO] Update Success!
    [LOG]
  • 1
  • test1
  • 123456
  • someone
  • 2020-03-31 20:31:36

  • 19
  • 123
  • test
  • test
  • 2020-03-31 19:19:05

  • 58
  • test
  • test
  • test
  • 2020-03-31 20:31:36

  • vitamin-framework-php's People

    Contributors

    kevinchen2046 avatar

    Watchers

    James Cloos avatar  avatar

    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.