ORM ??? Hyperf ?????? ???? ??
??:
Hyperf? ??? ?? ?? ??? ??? ??? ?? ??? ?? ??? ??? ????????. ?? ????? ORM(Object Relational Mapping) ??? ?? ??? ??? ??? ?? ??? ?????. ? ????? ORM ??? Hyperf ?????? ???? ??? ???? ?? ?? ??? ?????.
1. ?? ? ??
???? ?? ?? Hyperf ?????? ???? ??? ???? ???. ???? ?? ??? Hyperf ?? ??? ?????.
1.1 ??? ??
????? ?? ??? ???? ?????? ??? ?? ???? ?????.
composer require hyperf/model composer require hyperf/database
1.2 ?????? ?? ??
Hyperf ??????? ?????? ?? ??? ?? ??? Databases.php ??? ????. config/autoload ???? . ? ????? ???-???? ??????, ?? ? ?? ??? ?? ?????? ?? ??? ??? ? ????.
??? ??? ?????? ?? ????.
return [ 'default' => [ 'driver' => env('DB_DRIVER', 'mysql'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', 3306), 'database' => env('DB_DATABASE', 'test'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', 'password'), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'pool' => [ 'min_connections' => 1, 'max_connections' => 10, 'connect_timeout' => 10.0, 'wait_timeout' => 3.0, 'heartbeat' => -1, 'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60), ], 'options' => [ // ... ], ], ];
2. ?? ??
ORM ??? Hyperf ?????? ???? ?? ?? ??? ???? ???. ??? ?????? ???? ???? PHP ???? ?????. ??? ?? ??????? ?? ??? ? ????. Hyperf ??????? ??? Hyperf/Model/Model ???? ???? ?????? ???? ???? ??? ???? ???.
??? ??? ?? ?? ????.
<?php declare (strict_types=1); namespace AppModel; use HyperfDbConnectionModelModel; /** * @property int $id * @property string $name * @property int $age * @property string $gender */ class User extends Model { /** * The table associated with the model. * * @var string */ protected $table = 'users'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['name', 'age', 'gender']; /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = []; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = []; }
? ????? users?? ?????? ???? ???? User?? ??? ???? ????. ???? ???? ??? ??? ????, ????? ?? ??? ? ?? ??? ?????.
3. ?? ???
ORM ??? Hyperf ?????? ???? ?? ??? ?? ??? ???? ?? ?? ??? ? ????.
??? ? ?? ???? ?? ?? ????.
3.1 ?? ??? ??
use AppModelUser; $users = User::all(); foreach ($users as $user) { echo $user->name; }
3.2 ??? ??
use AppModelUser; $user = User::where('age', '>', 18)->first(); echo $user->name;
3.3 ?? ?? ??
use AppModelUser; $user = User::where('age', '>', 18) ->orWhere('gender', 'female') ->orderBy('age', 'desc') ->first(); echo $user->name;
3.4 ?? ?? ??
use AppModelUser; $count = User::where('age', '>', 18)->count(); echo $count;
4. Hyperf ???????? ??? create(), update() ? delete() ???? ???? ???? ??, ???? ? ??? ? ????.
4.1 ??? ??
use AppModelUser; User::create([ 'name' => 'Tom', 'age' => 20, 'gender' => 'male', ]);
4.2 ??? ????
use AppModelUser; $user = User::find(1); $user->name = 'Jerry'; $user->save();
4.3 ??? ??
use AppModelUser; $user = User::find(1); $user->delete();
5. ??
? ????? ORM ??? Hyperf ?????? ???? ??? ???? ???? ?? ??? ?????. ??? ?? ???? ?? ???????? ??, ??, ?? ? ?? ??? ?? ??? ? ????. ??? Hyperf ?????? ??? ??, ??? ?? ?? ?? ?? ?? ??? ??? ???? ?? ???? ?? ???? ? ????.
? ??? ??? ??? ????. ???? ?? ??? ??? ???? ???? ?? ??? ???. ORM ??? Hyperf ?????? ???? ???? ????!
? ??? ORM ??? Hyperf ?????? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PyCharm? ?? ?? ?? Python ?? ?? ??(IDE)?? Python ??? ?? ????? ???? ????? ??? ??? ??? ?????. ? ????? PyCharm? ?? ?? ??? ???? ??? ?? ??? ??? ???? ???? ??? ? ??? ???? ?? ??? ?????. 1. PyCharm ???? ? ?? ?? PyCharm ?? ????(https://www.jetbrains.com/pyc)? ???? ???.

LinuxDeploy ?? ?? ? ?? ?? LinuxDeploy? ???? Android ??? ??? Linux ???? ???? ???? ??? ???? ??? Linux ???? ??? ? ??? ???? ??? ?????. ? ????? LinuxDeploy? ?? ??? ?? ??? ??? ???? ??? ? ??? ? ? ??? ? ??? ???? ?? ??? ?????. ?? ??: Linux ????: ?? ??

??? ?? ????? ?? ???? ?? ???? ?? ? ??, ???? ???? ??? ??? ?? ??? ??? ????? ??? ??? ???? ?? ??? ?? ??? ?? ????? ?? ?? ?????? win10 ?? ??? ???? ? F2 ?? ???? ?? ??? ?? ???? 1. ???? ?? ??? ?? ?? ???? ? ? F2 ?? ????(??? ????? BIOS? ???? ??? ????). 2. BIOS ??????? ?? ??? ????(??? ???? ?? ??? ?? ? ??). ????? ??? ?? ??? ????. 3. ?? ?? SupervisorPassword ??? ?? ?????. 4. ?? ???? ??? ????? ? ? ??? ??? ?? ?? ???? ?? Dis? ?????.

PHP? ?????? ??? ??? ??? ??????? ???? ORM? ???? ??????. Laravel? EloquentORM? ???? ?? ?? ??? ???? ??????? ?? ??? ? ????. ?? ???? ????? Eloquent ???? ????? ??? ??? ???? ???? ORM? ??? ? ????.

????? ?????? ???? ??? ???? ??? ??? ???? ?? ? ??? ?? ?????. Huawei? ?? ??? ? ??? Huawei Mate60Pro? ???? ??? ????? ?????? ?? ??? ?????. ??? ??? ?? ???? ????? ?? ? ??? Huawei Mate60Pro ???? ???? ?? ??? ???????. ??, Huawei Mate60Pro ???? ??? ???? ??? ????, ?? ??? ?? ???? ?? ??? ??? ? ????. ??? ????? ???? ? ?? ??? ?? ??? ?????.

Hibernate ??? ??? ??? ???? ??????? ??? ? ??? ?? ?? ??? ?????. Join-subclass: ?? ???? ?? ?? ???? ?? ???? ?? ??? ???? ?????. ???? ???: ?? ???? ?? ???? ?? ???? ?? ??? ???? ????. Union-subclass: Joined-subclass? ????? ?? ??? ???? ?? ?? ??? ?? ?????.

Hibernate? Java ??? ??? ?????? ?? ??? ?? JavaORM ????????. ORM ?????? ?? ??? ?????. ??/??: ?? ???? ??? ?????? ???? ?? ???? ?? ?? XML ??? ?????. ?? ???: Hibernate? ?????? ?? ??? ?????. ??: ??????? ?? ?? ??? ???? ?? ? ???? ??? ???? ? ?????. ???: save() ?? update() ???? ?? ??????? ???? ?????. ??: Criteria ? HQL? ???? ???? ???? ??? ??? ?????.

Discuz ??? ?? ?? ?? ??? Discuz ?? ???? ???? ???? ??? ??? ??? ???? ?? ??? ????. ??? ??? ???? ??? ?? ??? ?? ?? ??? ???? ?? ??? ? ????. ? ???? Discuz ?? ????? ??? ??? ???? ??? ??? ???? ? ?? ???? ?? ??? ?????. 1. ??? ?? ??? ???? ?? ?? ??? ?? ??? ??? ???? ?? ???? ???? ???. Discuz??? ????? ??? ??? ??? ? ????
