Swish 函数
PHP 手册

Swish::__construct

(PECL swish >= 0.1.0)

Swish::__constructConstruct a Swish object

说明

void Swish::__construct ( string $index_names )
Warning

本函数是实验性的。本函数的行为,包括函数名称以及其它任何关于本函数的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本函数风险自担。

参数

index_names

The list of index files separated by spaces.

返回值

无返回值。

错误/异常

Throws SwishException on error.

范例

Example #1 A Swish::__construct() example

<?php

try {
    
$swish = new Swish("index1 index2");
} catch (
SwishException $e) {
    echo 
$e->getMessage(), "\n";
}

foreach (
$swish->indexes as $index) {
    
var_dump($index["name"]);
    
var_dump($index["headers"]["Total Words"]);
}

?>

上例的输出类似于:

string(6) "index1"
int(1888)
string(6) "index2"
int(2429)


Swish 函数
PHP 手册