34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
define("APP", dirname(__FILE__));
|
|
define("CONTROLLER", "lib\\Controller\\");
|
|
define("MODEL", "lib\\Model\\");
|
|
define("ENTITY", "lib\\Entity\\");
|
|
define("VIEW", "lib\\Vew\\");
|
|
|
|
define("MANGBOARD_ADMIN_ID", "admin");
|
|
define("MANGBOARD_POINT_UNIT", 1000);
|
|
define("MANGBOARD_LEVEL_USER_MIN", 1);
|
|
define("MANGBOARD_LEVEL_USER_MAX", 5);
|
|
define("MANGBOARD_LEVEL_ADMIN", 10);
|
|
define("MANGBOARD_LEVEL_OPERATOR", 7);
|
|
require_once __DIR__ . DIRECTORY_SEPARATOR . "lib/autoload.php";
|
|
try {
|
|
if (1 > $argc) {
|
|
throw new \Exception("사용법 : php app.php 클래스명 [함수명(default:execute) parameters]\n");
|
|
}
|
|
//php 파일명
|
|
$phpName = array_shift($argv);
|
|
|
|
//클래스 검사(Autoload)
|
|
$className = CONTROLLER . array_shift($argv);
|
|
$class = new $className();
|
|
|
|
//함수 검사
|
|
$functionName = array_shift($argv) ?: "execute";
|
|
if (!method_exists($class, $functionName)) {
|
|
throw new \Exception("클래스[{$className}]에 함수[{$functionName}]는 존재하지 않습니다.\n");
|
|
}
|
|
echo $class->$functionName($argv);
|
|
} catch (\Exception $e) {
|
|
echo $e->getMessage();
|
|
} //
|