SwishResults->seekResult
(PECL swish:0.1-0.3.0)
SwishResults->seekResult — Set current seek pointer to the given position
說明
int SwishResults->seekResult
( int $position
)
Warning
本函式是實驗性的。這個函式的行為、名稱、和關於此函式的任何其他文件在未來PHP的發行中可能會在不通知的情況下改變。 使用此函式需自行承擔風險。
參數
- position
-
Zero-based position number. Cannot be less than zero.
Return值
Returns new position value on success.
錯誤/例外
Throws SwishException on error.
範例
Example#1 Basic SwishResults->seekResult() example
<?php
try {
$swish = new Swish("index.swish-e");
$search = $swish->prepare();
$results = $search->execute("lost");
var_dump($results->seekResult(0)); //this will succeed
var_dump($results->seekResult(100)); //this will fail
} catch (SwishException $e) {
echo "Error: ", $e->getMessage(), "\n";
}
?>
上例的輸出類似於:
int(0) Error: No more results