- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
// строка 139
$parts = explode('@',self::$callbacks[$pos]);
$file = strtolower('app/controllers/'.$parts[0].'.php');
//try to load and instantiate model
if(file_exists($file)){
require $file;
}
//grab all parts based on a / separator
$parts = explode('/',self::$callbacks[$pos]);
//collect the last index of the array
$last = end($parts);
//grab the controller name and method call
$segments = explode('@',$last);
//instanitate controller
$controller = new $segments[0]();
$params = count($matched);
//call method and pass any extra parameters to the method
switch ($params) {
case '0':
$controller->$segments[1]();
break;
case '1':
$controller->$segments[1]($matched[0]);
break;
case '2':
$controller->$segments[1]($matched[0],$matched[1]);
break;
case '3':
$controller->$segments[1]($matched[0],$matched[1],$matched[2]);
break;
case '4':
$controller->$segments[1]($matched[0],$matched[1],$matched[2],$matched[3]);
break;
case '5':
$controller->$segments[1]($matched[0],$matched[1],$matched[2],$matched[3],$matched[4]);
break;
case '6':
$controller->$segments[1]($matched[0],$matched[1],$matched[2],$matched[3],$matched[4],$matched[5]);
break;
case '7':
$controller->$segments[1]($matched[0],$matched[1],$matched[2],$matched[3],$matched[4],$matched[5],$matched[6]);
break;
case '8':
$controller->$segments[1]($matched[0],$matched[1],$matched[2],$matched[3],$matched[4],$matched[5],$matched[6],$matched[7]);
break;
case '9':
$controller->$segments[1]($matched[0],$matched[1],$matched[2],$matched[3],$matched[4],$matched[5],$matched[6],$matched[7],$matched[8]);
break;
case '10':
$controller->$segments[1]($matched[0],$matched[1],$matched[2],$matched[3],$matched[4],$matched[5],$matched[6],$matched[7],$matched[8],$matched[9]);
break;
}
// ...
Вот так SimpleMVCFramework передает аргументы контролеру *facepalm*