-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli
More file actions
46 lines (38 loc) · 1.31 KB
/
cli
File metadata and controls
46 lines (38 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
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
<?php
/*
|---------------------------------------
| @author chengf28 <chengf_28@163.com>
|---------------------------------------
| 命令行
|---------------------------------------
|
*/
if ($argv[1]) {
$operate = $argv[1];
switch ($operate) {
case '-s':
case '-S':
$port = isset($argv[2]) ? $argv[2] : '80';
$string = 'php -S localhost:'.$port . (isset($argv[3]) ? $argv[3] : ' ./public/index.php');
`$string`;
break;
case 'clean':
foreach(glob('./storage/cache/templates/*') as $file)
{
unlink($file);
}
echo "done";
break;
}
}
// $namepos = strrpos($argv[2], '/');
// $namespace = substr($argv[2], 0, $namepos);
// $name = substr($argv[2], $namepos + 1);
// $rootpath = __DIR__ . DIRECTORY_SEPARATOR . 'framework';
// if (!file_exists($rootpath . DIRECTORY_SEPARATOR . $namespace)) {
// mkdir($rootpath . DIRECTORY_SEPARATOR . $namespace, 0777, true);
// }
// $content = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . "mould/$type.lm");
// $content = str_replace('REPLACENAMESPACE', $namespace, $content);
// $content = str_replace('REPLACECLASSNAME', $name, $content);
// file_put_contents($rootpath . DIRECTORY_SEPARATOR . $argv[2] . '.php', $content);