num ); $i++ ) { $current_xml = @simplexml_load_file( $XML.add_zero( $i ).".xml" ); for( $i2 = 0; $i2 < ( 0 + $current_xml->num ); $i2++ ) { // この章の本文を取得します。 $text = $current_xml->pages[0]->page[0 + $i2]->text; $text = fromxml( $text ); $text = substr( $text, 1 ); // 検索します。 $pos = strstr( $text, $query ); if( $pos != FALSE ) { $result = new SearchResult(); $result->chapter_no = add_zero( $i ); $result->page_no = add_zero( $i2 + 1 ); $result->title = fromxml( $current_xml->title ); $text = str_replace( $query, ''.$query.'', $text ); $result->text = nl2br( $text ); $results[] = $result; } } } } else { $status = -1; } ?>