Esempio n. 1
0
 public function testNormalize()
 {
     $param1 = ['controller' => 'Users', 'action' => 'index', 'arguments' => [0, 1]];
     $url1 = Router::normalize($param1);
     $this->assertEquals('/Users/index/0/1', $url1);
     $param2 = ['controller' => 'Users', 'action' => 'index'];
     $url2 = Router::normalize($param2);
     $this->assertEquals('/Users/index/', $url2);
 }
Esempio n. 2
0
 /**
 * リダイレクトを行う.
 *
 * @param array $param リダイレクト先の情報
 * 次の様に定義する
 * $param = 
 *   [
 *     'controller' => 'Users', 
 *     'action' => 'view',
 *     'arguments' => [
 *       1,'foo'
 *     ]
 *   ];
 *
 */
 public function redirect($param)
 {
     $url = Router::normalize($param);
     header('Location:' . $url);
     exit;
 }