This commit is contained in:
2023-04-17 19:01:24 +08:00
parent ffc60b9366
commit 17086f966c
+2 -1
View File
@@ -589,6 +589,7 @@ use Kiri\Router\Annotate\AutoController;
$this->rules[$val['Field']] = $_field; $this->rules[$val['Field']] = $_field;
} }
$namespace = str_replace('Controller', 'Form', $path['namespace']);
$path = str_replace('Controller', 'Form', $path['path']); $path = str_replace('Controller', 'Form', $path['path']);
if (!is_dir($_SERVER['PWD'] . '/app/Form/')) { if (!is_dir($_SERVER['PWD'] . '/app/Form/')) {
mkdir($_SERVER['PWD'] . '/app/Form/'); mkdir($_SERVER['PWD'] . '/app/Form/');
@@ -601,7 +602,7 @@ use Kiri\Router\Annotate\AutoController;
} }
file_put_contents($path . '/' . $formClass . 'Form.php', '<?php file_put_contents($path . '/' . $formClass . 'Form.php', '<?php
namespace App\Form; namespace ' . $namespace . ';
use Kiri\ToArray; use Kiri\ToArray;
' . implode(PHP_EOL, $header) . PHP_EOL . PHP_EOL . ' ' . implode(PHP_EOL, $header) . PHP_EOL . PHP_EOL . '