1. Go to this page and download the library: Download lfphp/porm 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/ */
lfphp / porm example snippets
use LFPhp\PORM\ORM\Model;
class User extends Model {
static public function getTableName(){
// TODO: Implement getTableName() method.
}
static public function getAttributes(){
// TODO: Implement getAttributes() method.
}
static protected function getDBConfig($operate_type = self::OP_READ){
// TODO: Implement getDBConfig() method.
}}
//查询对象
$user = UserTable::findOneByPK(1);
var_dump($user);
//更改对象
$user->name = 'Jack';
$user->save();
//新增对象
$user = new UserTable();
$user->name = 'Michel';
$user->save();
echo $user->id;