From 8d7bade5d3f1dd976220dfefbce5dbaa3b349851 Mon Sep 17 00:00:00 2001 From: Towers Date: Sat, 14 May 2016 07:38:17 +0800 Subject: [PATCH] When there is no controller error $klein->with("/$controller", "controllers/$controller.php"); --- src/Klein/Klein.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Klein/Klein.php b/src/Klein/Klein.php index 108dd539..9fdd783b 100644 --- a/src/Klein/Klein.php +++ b/src/Klein/Klein.php @@ -385,10 +385,17 @@ public function with($namespace, $routes) call_user_func($routes, $this); } } else { - require $routes; + if (file_exists($routes)) { + require $routes; + } else { + return false; + } + } $this->route_factory->setNamespace($previous); + + return true; } /**