PHP code example of easyswoole / words-match

1. Go to this page and download the library: Download easyswoole/words-match library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

easyswoole / words-match example snippets


use EasySwoole\WordsMatch\Config;
use EasySwoole\WordsMatch\WMServer;

nfig();

$config->setDict(__DIR__.'/tests/dictionary.txt');

WMServer::getInstance($config)->attachServer($http);

$http->on("request", function ($request, $response) {
    if(isset($request->get['world'])){
        $world = $request->get['world'];
    }else{
        $world = "计算机①级考试🐂替考+++++++++++++我";
    }
    $ret = WMServer::getInstance()->detect($world);
    $response->header("Content-Type", "application/json;charset=utf-8");
    $response->write(json_encode($ret,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES));
});

$http->start();


php,是世界上,最好的语言
java
golang
程序员
代码
逻辑
php※程序员