easy-swoole / words-match

17 stars 5 forks source link

swoole4.6 请求报错 #37

Open atlaschan000 opened 3 years ago

atlaschan000 commented 3 years ago

安装demo 允许简易请求 ` use EasySwoole\WordsMatch\Config; use EasySwoole\WordsMatch\WMServer;

require '../vendor/autoload.php';

$http = new \Swoole\Http\Server("127.0.0.1", 9501); $config = new Config(); $config->setDict(DIR.'/tests/dictionary.txt'); WMServer::getInstance($config)->attachServer($http); $http->on("request", function ($request, $response) {

try {
    if (isset($request->get['word'])) {
        $word = $request->get['word'];
        $ret = WMServer::getInstance()->detect($word);
        var_dump($ret);
    }
    else{
        $ret = [];
    }
}
catch(\Throwable $e){
    $ret = $e->getMessage();
}
$response->header("Content-Type", "application/json;charset=utf-8");
$response->write(json_encode($ret,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES));

});

$http->start(); ` [2021-06-01 20:44:45 98315.3] NOTICE request is illegal and it has been discarded, 79 bytes unprocessed [2021-06-01 20:44:45 98315.3] NOTICE finish (ERRNO 1005): session#9 does not exists [2021-06-01 20:44:45 *98315.3] NOTICE end (ERRNO 1005): session[9] is closed

$ret = WMServer::getInstance()->detect($word); 没获得任何结果

huizhang001 commented 3 years ago

晚上我瞅下