PHP code example of dingqing / e-php

1. Go to this page and download the library: Download dingqing/e-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dingqing / e-php example snippets


├─ router
  ├─ RouterInterface.php
  ├─ General.php      [普通路由]
  ├─ Pathinfo.php     [pathinfo路由]
  ├─ Userdefined.php  [自定义路由]
  ├─ Job.php          [脚本任务路由]
  └─ RouterStart.php  [路由策略入口类]

├─ orm
  ├─ Interpreter.php    [sql解析器]
  ├─ DB.php             [数据库操作类]
  ├─ Model.php          [数据模型基类]
  └─ db                 [数据库类目录]
    └─ Mysql.php        [mysql实体类]

/**
 * DB操作示例
 *
 * findAll
 *
 * @return void
 */
public function dbFindAllDemo()
{
    $where = [
        'id'   => ['>=', 2],
    ];
    $instance = DB::table('user');
    $res      = $instance->where($where)
                         ->orderBy('id asc')
                         ->limit(5)
                         ->findAll(['id','create_at']);
    $sql      = $instance->sql;

    return $res;
}

/**
 * 演示测试
 */
public function testDemo()
{
    $this->assertEquals(
        'Hello web-frame',
        // 执行demo模块index控制器hello操作,断言结果是不是等于'Hello web-frame' 
        App::$app->get('demo/index/hello')
    );
}