国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? PHP ????? ThinkPHP ThinkPHP6?? ???? ???? ??

ThinkPHP6?? ???? ???? ??

Jun 21, 2023 am 10:55 AM
?????(???) ??? ???(??) thinkphp (??)

? ?? ???? ???? ?? ??? ???? ?? ?? ??? ?????. ???? ?????? ????? ?? ??? ???? ???? ????? ? ???? ?? ??? ?? ? ??? ??? ? ????. ThinkPHP6??? ??? ??? ???? ???? ??? ?? ??? ??? ? ????.

  1. ????? ???? ?? ?? ??

ThinkPHP6?? ????? ?? ???? ??? ??? ? ?? ?? ??? ?????. ???? ??? ??? ???? ?? ????? ?? ? ????. ???? ?? ??? ??? ????.

(1) ???? ?? ??

?? ??? ???? app/middleware ????? AccessCount.php ???? ??? ??? ? ????.

php think make:middleware AccessCount

AccessCount.php ????, ?? ??? ??? ? ????:

<?php

namespace appmiddleware;

use Closure;

class AccessCount
{
    public function handle($request, Closure $next)
    {
        // 統(tǒng)計訪問量
        $access_count = cache('access_count') ?: 0;
        $access_count++;
        cache('access_count', $access_count);

        return $next($request);
    }
}

? ???? ??? ???? ?? ??? ???? ?? ?? ??? ??? ????? ??????. ????? ?? ?????? ???? ??? ???? ?? ? ??? ?? 1 ????? ? ??? ?? ??? ?????.

(2) ???? ??

app/middleware.php ??? AccessCount.php ????? ???? ?? ??? ??? ????.

return [
    ppmiddlewareAccessCount::class,
];

(3) ??? ??

??? ???? ??? ???? ??? ?? ??? ?? ??? ? ??? ? ????.

$access_count = cache('access_count');
echo '網(wǎng)站訪問量:' . $access_count;
  1. Redis? ???? ?? ?? ??

????? ???? ? ??? ?? ??? ???? ? ??? Redis? ???? ??? ?? ????. Redis? ??? ???? ???? ? ??? ? ?? ?? ???? ?????????. ThinkPHP6??? Redis? ???? ???? ??? ??? ??? ? ????.

???? ?? ??? ??? ????.

(1) Redis ??

????? config/database.php ???? Redis ?????? ?? ??? ???? ??, ??? ??? ????.

'redis' => [
    // 數(shù)據(jù)庫類型
    'type' => 'redis',
    // 服務(wù)器地址
    'hostname' => '127.0.0.1',
    // 服務(wù)器端口
    'port' => 6379,
    // 數(shù)據(jù)庫名
    'database' => 0,
    // 密碼
    'password' => '',
    // 連接參數(shù)
    'params' => [
        Redis::OPT_CONNECT_TIMEOUT => 5,
    ],
],

( 2) ?? ??

?? ??? ???? ? ??? ?? ?? ??? ? ????.

$redis =     hinkacadeCache::store('redis')->handler();
$access_count = $redis->incr('access_count');

? ??? Redis? incr ???? ???? ? ??? ?? ?? 1? ??? ? ?? ?????. ?? ??.

(3) ??? ??

?? ???? Redis? ???? ???, ?? ??? ?? ??? ? ??? ? ????.

$redis =     hinkacadeCache::store('redis')->handler();
$access_count = $redis->get('access_count');
echo '網(wǎng)站訪問量:' . $access_count;

Summary

????? ???? Redis? ???? ? ??? ?? ??? ???? ?? ?? ?????. ?? ?? ??? ????? ?? ??? ??? ? ?? ?? ??? ????? ?? ? ???? ?? ??? ?? ???? ??? ? ????. ??? ???? ??? ?? ?? ???? ???? ?? ???? ?? ???? ???? ??? ???? ???.

? ??? ThinkPHP6?? ???? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

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

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???