国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman1.4 升級(jí)指南

walkor

1.4升級(jí)指南

升級(jí)前請做好備份,執(zhí)行以下命令升級(jí)
composer require workerman/webman-framework ^1.4.3 && composer require webman/console ^1.0.27 && php webman install

注意
如果無法升級(jí),很可能是因?yàn)槭褂昧薱omposer代理,請使用以下命令 composer config -g --unset repos.packagist 恢復(fù)使用composer官方數(shù)據(jù)源

功能特性及變更

應(yīng)用插件

1.4版本支持應(yīng)用插件,更多請參考應(yīng)用插件

自動(dòng)路由

1.4版本支持各種復(fù)雜的控制器目錄規(guī)則,例如

app
app
├── admin
│?? └── v1
│??     └── v2
│??         └── v3
│??             └── controller
│??                 └── Index.php
└── controller
    ├── v1
    │?? └── Index.php
    └── v2
        └── v3
            └── Index.php

也就是說 webman/auto-route 插件不再需要了

控制器復(fù)用開關(guān)

1.4版本允許關(guān)閉控制器復(fù)用,在config/app.php中設(shè)置'controller_reuse' => false,,這樣每個(gè)請求都會(huì)重新初始化一個(gè)新的控制器,也就是說每個(gè)請求都會(huì)觸發(fā)對(duì)應(yīng)控制器的__construct()構(gòu)造函數(shù),開發(fā)者可以在構(gòu)造函數(shù)中為每個(gè)請求執(zhí)行一些請求處理前的初始化工作。

因?yàn)榭梢躁P(guān)閉控制器復(fù)用,所以webman/action-hook 插件的不再需要了。

開啟http服務(wù)

1.4 版本支持開啟多個(gè)端口提供http服務(wù)。
因?yàn)閣ebman請求是排隊(duì)處理的,如果某個(gè)請求處理速度慢,會(huì)影響排隊(duì)中的其它請求。
這時(shí)候我們可以再開一些進(jìn)程,把速度慢的接口放在這些進(jìn)程去處理。

例如新開一組8686端口的http進(jìn)程只需要在 config/process.php 里增加如下配置。

return [
    // ... 這里省略了其它配置 ...

    'task' => [
        'handler' => \Webman\App::class,
        'listen' => 'http://0.0.0.0:8686',
        'count' => 8, // 進(jìn)程數(shù)
        'constructor' => [
            'request_class' => \support\Request::class, // request類設(shè)置
            'logger' => \support\Log::channel('default'), // 日志實(shí)例
            'app_path' => app_path(), // app目錄位置
            'public_path' => public_path() // public目錄位置
        ]
    ]
];

這樣慢接口可以走 http://127.0.0.1:8686/ 這組進(jìn)程,不影響其它進(jìn)程的業(yè)務(wù)處理。

為了讓前端無感知端口的區(qū)別,可以在nginx加一個(gè)到8686端口的代理。假設(shè)慢接口請求路徑都是以/pay開頭,整個(gè)nginx配置類似如下:

upstream webman {
    server 127.0.0.1:8787;
    keepalive 10240;
}

# 新增一個(gè)8686 upstream
upstream slow {
   server 127.0.0.1:8686;
    keepalive 10240;
}

server {
  server_name webman.com;
  listen 80;
  access_log off;
  root /path/webman/public;

  # 以/pay開頭的請求走8686端口
  location /pay {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_pass http://slow;
  }

  # 其它請求走原8787端口
  location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      if (!-f $request_filename){
          proxy_pass http://webman;
      }
  }
}

這樣客戶端訪問域名.com/pay/xxx時(shí)將會(huì)走單獨(dú)的8686端口處理,不影響8787端口的請求處理。

視圖文件配置

后綴只能在view.php 的 options選項(xiàng)中配置。
不再支持的用法

use support\view\Raw;
return [
    'handler' => Raw::class,
    'view_suffix' => 'php'
];

正確的用法

use support\view\Raw;
return [
    'handler' => Raw::class,
    'options' => [
        'view_suffix' => '.php'
    ]
];

session驅(qū)動(dòng)命名空間變動(dòng)

webman從1.4.0起更改了SessionHandler類的命名空間,由原來的

use Webman\FileSessionHandler;  
use Webman\RedisSessionHandler;  
use Webman\RedisClusterSessionHandler;  

改為

use Webman\Session\FileSessionHandler;  
use Webman\Session\RedisSessionHandler;  
use Webman\Session\RedisClusterSessionHandler;

為了避免升級(jí)后程序直接報(bào)錯(cuò),Webman\FileSessionHandler類仍然被保留一段時(shí)間,在未來版本中會(huì)被徹底移除。

此變更影響config/session.php'handler'配置。

文檔連接 http://wtbis.cn/doc/webman/upgrade/1-4.html

7057 14 11
14個(gè)回答

meystack

webman的文檔缺少時(shí)間標(biāo)識(shí),這樣哪個(gè)頁面什么時(shí)候更新了都不清楚

  • walkor 2022-08-17

    事情太多了,這些沒時(shí)間做

  • kevin 2022-08-21

    可以開放文檔編輯,作者審核下就好了

roczyl

關(guān)閉控制器復(fù)用,對(duì)性能會(huì)有多大的影響?

  • walkor 2022-08-17

    相對(duì)于業(yè)務(wù)來說,可以忽略不計(jì)

Le

每個(gè)請求重新初始化控制器,是不是那種控制器里定義一些屬性,根據(jù)請求給屬性設(shè)置值的寫法,可以用了,,以前不初始化,這種寫法貌似是容易出問題

Tinywan

支持

liziyu

很贊,已經(jīng)成功升級(jí)了!~

return [
    'handler' => Raw::class,
    'options' => [
        'view_suffix' => '.php'
    ]
];

好這里好像不要加點(diǎn), 'view_suffix' => 'php'就行了,否則會(huì)報(bào)錯(cuò)!呵呵

咸魚.php

太棒了

  • 暫無評(píng)論
xianrenqh

太棒了

  • 暫無評(píng)論
admin2

贊!

  • 暫無評(píng)論
chaz6chez

支持

  • 暫無評(píng)論
10bang

支持

  • 暫無評(píng)論
深林孤鷹

1、正想問“如何優(yōu)雅的修改組件”問題來著,應(yīng)用插件就橫空出世了,哈哈~不過順便問下大神,假如我想修改一款組件,首先不能直接在vendor中直接修改(下次升級(jí)會(huì)覆蓋掉),那放在應(yīng)用插件里是不是最好的方法呢?
2、自動(dòng)路由 終于讓我盼到了~
3、控制器復(fù)用開關(guān):如果能單獨(dú)控制某個(gè)控制器復(fù)用就更好了,但不建議用 action-hook 插件,首先是它初始化的地方有點(diǎn)奇怪(在全局中間件在后,路由中間件之前。。),其次如果和 'controller_reuse' => false 一起使用的話會(huì)有點(diǎn)小bug:會(huì)創(chuàng)建兩個(gè)控制器,一個(gè)還不會(huì)析構(gòu)(估計(jì)是 action-hook插件內(nèi)部使用了 Container::get 創(chuàng)建了控制器)。

  • 陳品忠 2022-08-19

    1.自己發(fā)布包
    2.繼承它 然后重寫

陳品忠

./composer.json has been updated
Running composer update workerman/webman-framework
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
11 packages you are using are looking for funding.
Use the composer fund command to find out more!
No security vulnerability advisories found
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Info from https://repo.packagist.org: #StandWithUkraine
升級(jí)好像卡住了

  • 陳品忠 2022-08-19

    composer require workerman/webman-framework
    composer require webman/console
    php webman install
    我拆開后運(yùn)行 可以了

展白

支持,已升級(jí)。

  • 暫無評(píng)論
Dalong

支持請求掛起了嗎

  • walkor 2022-08-23

    不支持

  • Dalong 2022-08-23

    revolt/event-loop 還沒發(fā)布穩(wěn)定版本嗎

  • Tinywan 2022-08-23

    估計(jì)的PHP8.2發(fā)布后發(fā)布

  • Dalong 2022-08-23

    @Tinywan,預(yù)計(jì)多久8.2發(fā)布?

  • Tinywan 2022-10-10

    今年 11 月正式發(fā)布

年代過于久遠(yuǎn),無法發(fā)表回答
??