Yii ????? ????: ??????? ?? ?? ??? ??? ?? ??
??
????(????)? ??????? ?? ?? ??? ??? ??? ???? Yii ??????? ??? ?????. ????? ???? ???? ??????? ??? ?? ??? ??? ?? ??? ?????. ????? ?? ??? ??, ??, ???? ? ??? ??? ?? ???? ?? ?? ???? ??? ? ????.
Yii ?????? ????? ??? ?? ?????. ??????? ?? ???? ?? ??? ???? ?? ???. ????? ??? ?? Yii ??????? ????? ???? ??? ??? ???????.
Example
Yii ?????? ???? ?? ?? ??????? ????? ??? ?????. ? ????????? MySQL ? Redis? ??? ??? ??? ?? ??? ???? ???. ??? ? ??? ???? ?? ????? ??? ????.
?? ??????? ?? ???? ????? ???? ???. config/main.php ??? ?? ??? ?????:
'comComponents' => [
// ... 'middleware' => [ 'class' => 'yiiwebMiddlewareDispatcher', 'middlewares' => [ [ 'class' => 'appmiddlewaresDatabaseMiddleware', 'db' => 'mysql', ], [ 'class' => 'appmiddlewaresCacheMiddleware', 'cache' => 'redis', ], ], ], // ...
],
? ????? ???? ??? middlewares ??? ?? ? ?? ????? DatabaseMiddleware? CacheMiddleware? ??????. ?? DatabaseMiddleware? ?????? ?? ??? ???? ? ???? db?? ?? ??? ?? ?????? ??? ?????. CacheMiddleware? ?? ?? ??? ???? ? ???? ?? ??? ???? ?? ??? ????.
???? DatabaseMiddleware? CacheMiddleware? ??? ?? ???? ?? ? ?? ???? ???? ???? ???. app/middlewares ????? ? ?? ?? DatabaseMiddleware.php ? CacheMiddleware.php? ???? ?? ??? ?????:
namespace appmiddlewares;
use yii aseBaseObject;
use yiiwebRequest;
use yiiwebResponse;
use yiidbConnection;
class DatabaseMiddleware? BaseObject? ?????
{
public $db; public function handle(Request $request, Response $response, $next) { // 執(zhí)行數(shù)據(jù)庫操作 $connection = new Connection([ 'dsn' => 'mysql:host=localhost;dbname=task_manager', 'username' => 'root', 'password' => '', ]); // ... $connection->open(); // ... $connection->close(); return $next($request, $response); }
}
class CacheMiddleware? BaseObject? ?????
{
public $cache; public function handle(Request $request, Response $response, $next) { // 執(zhí)行緩存操作 $cache = new Cache([ 'class' => 'yiicachingRedisCache', 'redis' => 'redis', ]); // ... $cache->set('key', 'value'); // ... $cache->delete('key'); return $next($request, $response); }
}
? ????? DatabaseMiddleware? CacheMiddleware? ?? ???? ?? ???? ?????? ??? ??? ??????. ??. ? ????? ?? ?????? ?? ?? ??? ?? ??? ??? ? $next($request, $response)? ???? ?? ???? ?? ?? ???? ??? ?????.
????? ????? ?? ??? ???? ?? ??? ???? ????? ??? ? ????.
Yii::$app->middleware->dispatch(Yii::$app->request, Yii: :$app->response, function ($request, $response) {
// 處理程序邏輯
});
? ????? Yii::$app->middleware->dispatch ???? ?? ????? ?????. , ?? ??? ?? ?? ??? ??? ?????. ? ?? ????? ??? ?? ???? ?? ??? ??? ? ????.
??
Yii ??????? ????? ???? ??????? ?? ??? ?? ??? ??? ? ????. ??? ???? ???? ???? ???? ?????? ??? ????? ?? ???? ??? ? ????. ? ?? Yii ?????? ????? ???? ???? ? ??? ??? ????.
? ??? Yii ????? ????: ??????? ?? ?? ??? ???? ?? ??? ?? ?????. ??? ??? 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)

??? ??











localstorage? ???? ???? ?? ?? ???? ??? ?????? ?? ?? ??? ?????. ????? ????? ??? ??? ???? ?? ??? ???? ???? ?? ?? ???? ?? ???? ???? ?? ??? ????. Localstorage? ????? ? ??? ??? ?? HTML5?? ???? ???, ???? ?? ???? ?? ? ???? ???? ??? ???? ???? ??? ??? ?????. ??? ??? ??? ?? ?? ???? ??? ? ???

Tomcat ????? ??? Java Servlet ? Java EE ??? ???? ?????. ??? ?????? Tomcat? HTTP ?? ? ??? ???? ? ??????? ?? ?? ??? ???? ?? ?????. Tomcat ????? ?? ??? ??? ????: 1. ???? ?? 2. ??? ?? ???? 4. ?? ?? 6. ????? ? ?? ??? 9. ???? ?? ?

2? 11? ? ???? ??? ??? ??? ?? ??? ??? 2024? ??? ??? ???? ?? ??? ?? ????? 2? 20? ??? ????. ? ???? ??? ???? ??? ??? ????. ???? ??? ?? ??? ??? ?? ???? ?? ??? ?? ???? ?? ?? ?????. ??? ???? ??? ??? ??, ?? ? ??? ?? ??? ?? ??? ???. ??? ?? ??? ??? ??? ???? ??? ???? ??? ?????. ?? ??? ??? ??? ??? ??? ???? ??? ?? ??? ?????. ???? ICT ??? ???? ???? ??? ???, ?? ??? ?? ??? ????, ??? ??? "???? ????, ?? ?? ????, ???? ?? ? ?????" ???? ? ???? ??? ?? ????. ??? ???? ??? ????.

dat ??? ??? ??? ???? ???? ? ??? ? ?? ?? ??? ?? ?????. dat ???? ???, ???, ??? ? ???? ?? ??? ??? ??? ??? ? ????. ??? ?? ????? ?? ???? ?? ?????. dat ??? ????? ???? ?? ??? ??? ???? ???? ???? ?????. ?? dat ??? ????? ?? ??? ??? ???? ?? ?? ? ? ??? ?????. ?? dat ??? ???? ???? ?? ????? ?? ?????? ??? ?????. ?

Workerman?? ??? ??? ?? MySQL? ???? ?? Workerman? ??? ???? PHPSocket ??????? ???? ?? ?? ??? ?? ?????. ?? ?? ?????? ??? ?? ? ??? ?? MySQL? ???? ?? ??? ????. ????? Workerman?? ??? ??? ?? MySQL? ???? ??? ???? ???? ?? ??? ?????. 1. MySQL ??? ???? ?? M? ???? ??? ???? ???.

Tomcat ????? ?? ?? ??? ????? ?? ?? ??? ?????. Tomcat? ?? ???? ?? ?? Java ? ?? ? ??? ???????. ???? ???? ???? ????? Java ? ??????? ???? ???? ? ?????. Tomcat ????? ?? ?? ??? ? ? ????? ?? ?? ??? ?? ????? ???? ???. ? ????? ?? ?? ??? ?? Tomcat ????? ?? ?? ??? ?????. ?

Redis? ??? ?? ? ???? ???? ????? ?? ??? ?? ? ?? ????? ?? ?? ??????? ????????. 1) Redis? ???, ??, ???, ?? ??? ? ?? ???? ?? ??? ??? ???? ?? ? ??? ???? ??? ?????. 2) RDB? AOF? ? ?? ?? ??? ?? Redis? ??? ??? ???? ? ???? ?? ??? ?????.

Java ?????? ?? ??? ???? ???? ??? ? ??? ??? ?????. ?? ?? ?? ?? ??? ???? ?? ??. ??? ?? ????? ???? ???? ??? ?? ???? ?????. ??? ?? ???? ??? ??? ???? ?????. ?? ?? ?? ??? ?? ?? ????? ???? ???? ?????.
