1.首先用composer加载结巴中文分词-PHP
composer require fukuball/jieba-php:dev-master
2.在composer.json 中引用, 让他自动加载
3.执行 composer dump-autoload 加载
4.使用方法
ini_set('memory_limit', '1024M'); $jb = new \Fukuball\Jieba\Jieba;
$fg = new \Fukuball\Jieba\Finalseg; Jieba::init();
Finalseg::init();
$seg_list = Jieba::cut("怜香惜玉也得要看对象啊!"); dd($seg_list);
5.效果
参考:
https://learnku.com/articles/13601/the-use-of-php-thesaurus-jieba-and-scws-in-laravel