添加部署配置环境的判断
parent
d7dbac6868
commit
e2c31c714f
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Application configuration
|
||||
*
|
||||
|
@ -19,6 +21,7 @@ class Config
|
|||
* @var string
|
||||
*/
|
||||
const DB_NAME = 'background';
|
||||
const ROUTE_PREFIX_DEV = "/api/public/";
|
||||
const ROUTE_PREFIX = "/wapi/";
|
||||
/**
|
||||
* Database user
|
||||
|
@ -36,3 +39,4 @@ class Config
|
|||
*/
|
||||
const SHOW_ERRORS = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,11 @@ $router = new Core\Router();
|
|||
$router->add('', ['controller' => 'Home', 'action' => 'index']);
|
||||
$router->add('{controller}/{action}');
|
||||
$router->add('{controller}/{action}/{id:.+}');
|
||||
if($_SERVER['HTTP_HOST'] == '127.0.0.1')
|
||||
$router->AddPrefix(\App\Config::ROUTE_PREFIX_DEV);
|
||||
else
|
||||
$router->AddPrefix(\App\Config::ROUTE_PREFIX);
|
||||
|
||||
$router->AddPrefix(\App\Config::ROUTE_PREFIX);
|
||||
try{
|
||||
//for prefight request
|
||||
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
|
||||
|
|
Loading…
Reference in New Issue