文字

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)
上一篇: 下一篇: