Update cli.php

This commit is contained in:
Namhyeon Go 2020-04-20 20:11:46 +09:00 committed by GitHub
parent 290e26cb63
commit 32832519a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

19
cli.php
View File

@ -75,19 +75,14 @@ date_default_timezone_set($default_timezone);
$route = "welcome"; $route = "welcome";
// set arguments of command line // set arguments of command line
$opts = setopt("r::h::", array("route::", "host::")); $opts = getopt("r::h::", array("route::", "host::"));
set_shared_var("route", $opts['route']); if(!empty($opts['route'])) {
set_shared_var("host", $opts['host']); $route = $opts['route'];
}
// load route // set global variables
if(empty($route)) { set_shared_var("route", $route);
$route = get_value_in_array("default_route", $config, "welcome"); set_shared_var("host", $opts['host']);
} else {
$route_names = explode('/', $route);
if(count($route_names) > 1) {
$route = $route_names[0];
}
}
// load route file // load route file
if(!loadRoute($route, $shared_vars)) { if(!loadRoute($route, $shared_vars)) {