优化代码生成

This commit is contained in:
JaguarJack
2020-05-05 21:52:44 +08:00
parent 635f3e00d0
commit 72eb174946
3 changed files with 36 additions and 15 deletions

View File

@@ -29,8 +29,13 @@ class Route extends Factory
}
}
return file_put_contents($this->getModulePath($this->controller) . DIRECTORY_SEPARATOR . 'route.php',
$this->header() . implode(';'. PHP_EOL , $route) . ';');
$router = $this->getModulePath($this->controller) . DIRECTORY_SEPARATOR . 'route.php';
if (file_exists($router)) {
return file_put_contents($router, PHP_EOL . implode(';'. PHP_EOL , $route) . ';', FILE_APPEND);
}
return file_put_contents($router, $this->header() . implode(';'. PHP_EOL , $route) . ';');
}
/**