54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
// 加载环境变量配置
|
|
require_once dirname(dirname(__DIR__)) . '/env_config.php';
|
|
|
|
$_db_host = env('API_DB_HOST', 'rm-bp1btyuwq77591x0jpo.mysql.rds.aliyuncs.com');
|
|
$_db_port = env('API_DB_PORT', '3306');
|
|
$_db_name = env('API_DB_NAME', 'youlehudong');
|
|
$_db_user = env('API_DB_USER', 'games');
|
|
$_db_pass = env('API_DB_PASSWORD', 'Games0791!!');
|
|
|
|
return [
|
|
"phprs\\Router"=>[
|
|
"properties"=>[
|
|
"export_apis"=>true, //Enable output api documents, if true, visit http://your-host:port/apis/ to get documents
|
|
//,"hooks":["MyHook1","MyHook2"] //Enable hooks
|
|
"url_begin"=>1, // if url is "/abc/123", then 1st path node "/abc/" will be ignored.
|
|
"api_path"=>__DIR__.'/apis/',
|
|
//"default_strict_matching"=>true, //sub path do not match the parent path route in strict mode.
|
|
]
|
|
],
|
|
"phprs\\Invoker"=>[
|
|
"properties"=>[
|
|
//"cache":"@invokeCache" //cache result of apis(the apis with @cache)
|
|
]
|
|
]
|
|
|
|
//if the property "cache" of phprs\\Invoker is set
|
|
/**
|
|
,
|
|
"invokeCache"=>[
|
|
"class"=>"phprs\\util\\RedisCache",
|
|
"singleton"=>true,
|
|
"properties"=>[
|
|
"serialize"=>true,
|
|
"host"=>"127.0.0.1",
|
|
"port"=>"6379"
|
|
]
|
|
]
|
|
*/
|
|
|
|
//db config sample, and ezphp can work with PDO simply
|
|
,
|
|
"db"=>[
|
|
"singleton"=>true,
|
|
"class"=>"PDO",
|
|
"pass_by_construct"=>true,
|
|
"properties"=>[
|
|
"dsn"=>"mysql:host={$_db_host}:{$_db_port};dbname={$_db_name};charset=utf8",
|
|
"username"=>$_db_user,
|
|
"password"=>$_db_pass
|
|
]
|
|
]
|
|
|
|
]; |