Created
January 18, 2018 18:41
-
-
Save tayfunerbilen/a4036b614d02aac33c072333720a62cc to your computer and use it in GitHub Desktop.
https://youtu.be/LvBiSNUqMMg dersi kaynak dosyası
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dizi_filtrele($callback, $arr) | |
{ | |
$result = []; | |
if (is_callable($callback) && is_array($arr)){ | |
foreach($arr as $key => $val){ | |
$result[] = call_user_func($callback, $val); | |
} | |
} | |
return $result; | |
} | |
$arr = [ | |
'tayfun', | |
'güner' | |
]; | |
$arr = dizi_filtrele(function($name){ | |
return $name . ' erbilen'; | |
}, $arr); | |
//print_r($arr); | |
function Rota($url, $callback){ | |
$requestURI = $_SERVER['REQUEST_URI']; | |
if ($requestURI == $url){ | |
if (is_callable($callback)){ | |
$callback(); | |
} elseif (function_exists($callback)){ | |
$callback(); | |
} elseif (file_exists(__DIR__ . '/include/' . $callback . '.php' )){ | |
require_once __DIR__ . '/include/' . $callback . '.php' ; | |
} | |
} | |
} | |
Rota('/', function(){ | |
echo 'anasayfa!'; | |
}); | |
Rota('/uyeler', function(){ | |
echo 'üyeler kısmındasın!'; | |
}); | |
Rota('/cikis', 'cikis_yap'); | |
function cikis_yap() | |
{ | |
echo 'çıkış yap fonksiyonu!'; | |
} | |
Rota('/konular', 'konular'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment