本文整理匯總了PHP中Indexer::index_file方法的典型用法代碼示例。如果您正苦於以下問題:PHP Indexer::index_file方法的具體用法?PHP Indexer::index_file怎麽用?PHP Indexer::index_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Indexer
的用法示例。
在下文中一共展示了Indexer::index_file方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: function
$server->get('/index', function ($request, $response, $next) use($indexer) {
$response->write(json_encode(array('status' => $indexer->status, 'last_indexed_file' => $indexer->last_indexed_file)));
$next();
});
$server->post('/index', function ($request, $response, $next) use($indexer) {
echo "Starting index...\n";
$next();
$indexer->index();
echo "Index complete.\n";
});
$server->post('/reindex', function ($request, $response, $next) use($indexer) {
echo "Starting reindex...\n";
if ($request->file) {
$file = realpath($request->file);
$indexer->delete_file_index($file);
$indexer->index_file($file);
} else {
$indexer->delete_index();
$indexer->index();
}
echo "Indexing completed.\n";
$next();
});
$server->post('/index-php', function ($request, $response, $next) use($indexer_php) {
$indexer_php->delete_index();
$indexer_php->index();
echo "Indexing Complete\n";
$next();
});
$server->post('/updateindex', function ($request, $response, $next) use($indexer) {
echo "Updating reindex...\n";