多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[Xunsearch PHP-SDK](http://www.xunsearch.com) v1.4.8 API 参考文档 # XSTokenizerXlen [All Packages](#)| [方法(函数)](#) | 包 | [XS.tokenizer](#) | |-----|-----| | 继承关系 | class XSTokenizerXlen | | 实现接口 | [XSTokenizer](#) | | 版本 | 1.0.0 | | 源代码 | [sdk/php/lib/XSTokenizer.class.php](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSTokenizer.class.php) | 内置的定长分词器 ### Public 方法 [隐去继承来的方法](#) | 名称 | 描述 | 定义于 | |-----|-----|-----| | [__construct()](#) | | XSTokenizerXlen | | [getTokens()](#) | | XSTokenizerXlen | ### 方法明细 __construct()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public void <b>__construct</b>($arg=NULL)</div></td></tr><tr><td class="paramNameCol">$arg</td> <td class="paramTypeCol"></td> <td class="paramDescCol"></td></tr></table> **源码:**[sdk/php/lib/XSTokenizer.class.php#L106](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSTokenizer.class.php#L106) (**[显示](#)**) `public function __construct($arg = null) {     if ($arg !== null && $arg !== '') {         $this->arg = intval($arg);         if ($this->arg < 1 || $this->arg > 255) {             throw new XSException('Invalid argument for ' . __CLASS__ . ': ' . $arg);         }     } }` getTokens()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public void <b>getTokens</b>($value, $doc=NULL)</div></td></tr><tr><td class="paramNameCol">$value</td> <td class="paramTypeCol"></td> <td class="paramDescCol"></td></tr><tr><td class="paramNameCol">$doc</td> <td class="paramTypeCol"></td> <td class="paramDescCol"></td></tr></table> **源码:**[sdk/php/lib/XSTokenizer.class.php#L116](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSTokenizer.class.php#L116) (**[显示](#)**) `public function getTokens($value, XSDocument $doc = null) {     $terms = array();     for ($i = 0; $i < strlen($value); $i += $this->arg) {         $terms[] = substr($value, $i, $this->arg);     }     return $terms; }` Copyright © 2008-2011 by [杭州云圣网络科技有限公司](http://www.xunsearch.com) All Rights Reserved.