PHP code example of thefunpower / db_medoo

1. Go to this page and download the library: Download thefunpower/db_medoo 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/ */

    

thefunpower / db_medoo example snippets

   
 
namespace model; 

class user extends \model{ 
    protected $table = 'users';

    protected $field = [
        'name'  => '姓名',
        'phone' => '手机号',
        'email' => '邮件',
    ];

    protected $validate = [
        '  protected $unique_message = [
        '手机号已存在',
        '邮件已存在',
    ];
    

    /**
    * 写入数据前
    */
    public function before_insert(&$data){ 
        parent::before_insert($data);
        $data['created_at'] = now();
        parent::before_insert($data);
    }