lookjapan.COM - IRC ve mIRC dünyasının forumu!

lookjapan.COM - IRC ve mIRC dünyasının forumu! (http://www.lookjapan.com/index.php)
-   PHP (http://www.lookjapan.com/forumdisplay.php?f=137)
-   -   PHP Sansür Fonksiyonu (http://www.lookjapan.com/showthread.php?t=4006)

Vesaire 31 Ağustos 2016 14:02

PHP Sansür Fonksiyonu
 
Sansür fonksiyonu metininizdeki istemediğiniz kelimeleri bulup sansürler.

Fonksiyon:


PHP- Kodu:

<?php 
function sansur($dosya,$metin) { 
$words explode(","file_get_contents($dosya)); 
$replace = array(); 
foreach (
$words as $key => $word

    
$words[$key] = "/{$word}/i"
    
$replace[]   = "(sansür)"

echo 
preg_replace($words$replace$metin); 

?>


Kullanım:


PHP- Kodu:

<? 
$string 
"deneme len küfür etmek"
sansur("kufur.txt",$string); 
?>

kufur.txt içeriği:

Kod:

len, küfür


All times are GMT +3. The time now is 04:04.

Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.