İçinde metin dosyaları bulunan bir dizinin tamamını arayan bir php komut dosyası hazırladım, her şey iyi çalışıyor, ancak büyük/küçük harf duyarlı. Büyük/küçük harfe duyarlı olmadan nasıl arayabilirim?PHP strpos nasıl kullanılır?
<?php
$query = $_POST['search'];
if ($handle = opendir('posts')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "<p>$entry ";
$file = file_get_contents('posts/'.$entry, FILE_USE_INCLUDE_PATH);
$check_str = strpos($file,$query);
if ($check_str == 0) {
print "not found</p>";
} else {
print "found</p>";
}
}
}
closedir($handle);
}
?>
stripos http://php.net/manual/en/function.stripos.php yeterince uygun –
olası yinelenen: http://stackoverflow.com/questions/6795383/how-to-make-strpos-case-insensitive –
Bu soruyu bile görmedim. –