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

請(qǐng)求時(shí)發(fā)現(xiàn)報(bào)錯(cuò):getRealIp

dgkerry

問(wèn)題描述

我發(fā)現(xiàn)當(dāng)我頻繁刷新某個(gè)接口時(shí),會(huì)出現(xiàn)這個(gè)問(wèn)題,請(qǐng)問(wèn)出現(xiàn)這個(gè)問(wèn)題是什么原因的呢?

報(bào)錯(cuò)信息

Error: Call to undefined method Workerman\Protocols\Http\Request::getRealIp() in /www/wwwroot/[項(xiàng)目]/vendor/workerman/webman-framework/src/Exception/ExceptionHandler.php:68
Stack trace:
#0 /www/wwwroot/[項(xiàng)目]/vendor/workerman/webman-framework/src/support/exception/Handler.php(35): Webman\Exception\ExceptionHandler->report()
#1 /www/wwwroot/[項(xiàng)目]/vendor/workerman/webman-framework/src/App.php(280): support\exception\Handler->report()
#2 /www/wwwroot/[項(xiàng)目]/vendor/workerman/webman-framework/src/App.php(354): Webman\App::exceptionResponse()
#3 /www/wwwroot/[項(xiàng)目]/vendor/workerman/webman-framework/src/App.php(150): Webman\App::Webman\{closure}()
#4 /www/wwwroot/[項(xiàng)目]/app/process/Bot.php(49): Webman\App->onMessage()
#5 /www/wwwroot/[項(xiàng)目]/vendor/workerman/workerman/src/Connection/TcpConnection.php(676): app\process\Bot->onMessage()
#6 /www/wwwroot/[項(xiàng)目]/vendor/workerman/workerman/src/Events/Swoole.php(288): Workerman\Connection\TcpConnection->baseRead()
#7 [internal function]: Workerman\Events\Swoole->Workerman\Events\{closure}()
#8 {main}

config/process

/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.wtbis.cn/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

use support\Log;
use support\Request;
use app\process\Http;
use app\process\Bot;
use app\process\Task;
global $argv;

return [
    'webman' => [
        'handler' => Bot::class,
        'listen' => 'http://0.0.0.0:8787',
        'count' => 1,
        'user' => '',
        'group' => '',
        'reusePort' => false,
        'eventLoop' => Workerman\Events\Swoole::class,
        'context' => [],
        'constructor' => [
            'requestClass' => Request::class,
            'logger' => Log::channel('default'),
            'appPath' => app_path(),
            'publicPath' => public_path()
        ]
    ],
    'task'=>[
        'handler'  => Task::class,
        'eventLoop' => Workerman\Events\Swoole::class,
    ],
    // File update detection and automatic reload
    'monitor' => [
        'handler' => app\process\Monitor::class,
        'reloadable' => false,
        'constructor' => [
            // Monitor these directories
            'monitorDir' => array_merge([
                app_path(),
                config_path(),
                base_path() . '/process',
                base_path() . '/support',
                base_path() . '/resource',
                base_path() . '/.env',
            ], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
            // Files with these suffixes will be monitored
            'monitorExtensions' => [
                'php', 'html', 'htm', 'env'
            ],
            'options' => [
                'enable_file_monitor' => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/',
                'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
            ]
        ]
    ]
];
###app\process\Bot;
<?php

namespace app\process;

use Webman\App;
use app\service\SyncBinance;
use Workerman\Timer;
use Workerman\Coroutine\Context;
use diyvendor\logger\Log;
use React\Async;
class Bot extends App
{
    public function onWorkerStart($worker)
    {

        parent::onWorkerStart($worker);
    }
    public function onMessage($connection, $request){
        parent::onMessage($connection, $request);
    }

}
590 2 1
2個(gè)回答

walkor 打賞

可能你配置有問(wèn)題,發(fā)下 config/process.php

  • dgkerry 2025-03-18

    已在帖子上補(bǔ)上這個(gè)文件代碼,出現(xiàn)這個(gè)問(wèn)題,不知道是不是我修改了文件后網(wǎng)站重新運(yùn)行或者說(shuō)用了梯子(有時(shí)候要去google搜索問(wèn)題時(shí)用)

walkor 打賞
public function onMessage($connection, $request){
    var_dump(get_class($request));
    parent::onMessage($connection, $request);
}

onMessage加一個(gè)打印,請(qǐng)求下看下輸出什么

  • dgkerry 2025-03-18

    string(15) "support\Request"
    /www/wwwroot/[項(xiàng)目]/app/controller/IndexController.php updated and reload
    Workerman[start.php] reloading
    string(32) "Workerman\Protocols\Http\Request"
    string(32) "Workerman\Protocols\Http\Request"
    string(32) "Workerman\Protocols\Http\Request"
    string(15) "support\Request"

    1、第一行為正常請(qǐng)求時(shí)返回的數(shù)據(jù)
    2、第二條為報(bào)錯(cuò)后返回的數(shù)據(jù)
    3、接下來(lái)3條為報(bào)錯(cuò)后我繼續(xù)刷新的數(shù)據(jù)
    4、最后一條為我復(fù)制一樣的url在新窗口打開(kāi)的數(shù)據(jù)(此時(shí)不報(bào)錯(cuò))

    因?yàn)槲矣肰isual Studio Code編輯器編輯代碼,使用sftp插件來(lái)上傳,但由于服務(wù)器上傳有點(diǎn)差,文件上傳要幾秒,我嘗試在保存后,一直刷新,我發(fā)覺(jué)在sftp插件上傳成功后立馬刷新,就會(huì)出現(xiàn)這個(gè)問(wèn)題,要是等1秒后刷新就不會(huì)有那個(gè)報(bào)錯(cuò),還有好奇的是,報(bào)錯(cuò)后繼續(xù)刷新繼續(xù)刷新,就會(huì)繼續(xù)報(bào)錯(cuò)(第三點(diǎn)),而復(fù)制一樣的url在新窗口打開(kāi)卻正常(第四點(diǎn))

  • walkor 2025-03-18

    啟動(dòng)命令是什么

  • dgkerry 2025-03-18

    平時(shí)我用寶塔方式啟動(dòng)【php /www/wwwroot/項(xiàng)目/start.php start】,為了輸出上述信息,使用的命令為php start.php start

  • dgkerry 2025-03-18

    我直接在服務(wù)器上修改,沒(méi)有發(fā)現(xiàn)上述問(wèn)題,就是使用本地編輯器修改并使用sftp上傳才會(huì)出現(xiàn)

  • walkor 2025-03-18

    服務(wù)器改下文件 vendor/workerman/webman-framework/src/App.php
    截圖
    構(gòu)造函數(shù)加一行 Http::requestClass(static::$requestClass);
    restart 重啟然后試下

  • dgkerry 2025-03-18

    添加后人工手動(dòng)重啟,一樣的手法一樣的錯(cuò)誤,我發(fā)現(xiàn)只是調(diào)試模式下使用外部工具上傳文件才有問(wèn)題,不過(guò)要是每次文件修改完上傳后再人工手動(dòng)重啟就沒(méi)問(wèn)題

  • walkor 2025-03-18

    vendor/workerman/workerman/src/Worker.php
    截圖
    加一句 $worker->pauseAccept();

  • walkor 2025-03-18

    然后restart重啟

??