Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swoole4.6 请求报错 #37

Open
atlaschan000 opened this issue Jun 1, 2021 · 1 comment
Open

swoole4.6 请求报错 #37

atlaschan000 opened this issue Jun 1, 2021 · 1 comment

Comments

@atlaschan000
Copy link

atlaschan000 commented Jun 1, 2021

安装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
Copy link
Contributor

晚上我瞅下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants