-
Notifications
You must be signed in to change notification settings - Fork 0
Application
Axios edited this page Dec 14, 2020
·
5 revisions
\tpr\App::default();
Need install tpr-workerman library.
composer require axios/tpr-workerman
write follow code in the entry of program.
public/index.php
for example
\tpr\App::registerServer('workerman', \tpr\server\WorkermanServer::class);
// start application
\tpr\App::drive('workerman')->run();
// or
\tpr\App::workerman()->run();
\tpr\App::registerServer('custom-server-name', CustomServerHandlerClassName::class)
Get details from the AppModel code.
will cache config&routes data on the debug mode.
\tpr\App::debugMode(true);
\tpr\App::default()
->config([
'namespace' => 'app'
]);
option name | intro | default |
---|---|---|
name | the name of application. | 'app' |
namespace | the base namespace of application. | 'App' |
lang | the name of default language set. | 'zh-cn' |
cache_time | global cache time for config&route data. | 60 |
default_content_type_cgi | default content-type on cgi mode. | 'html' |
default_content_type_ajax | default content-type on api request. | 'json' |
default_content_type_cli | default output format of data on cli mode. | 'text' |
force_route | forces use routes for dispatch request. | false |
controller_rule | the spelling rule of controller namespace. | '{app_namespace}\\{module}\\controller\\{controller}' |
remove_headers | emove some header before send response. |
[] empty array |
server_options | the configuration of custom server handler. |
[] empty array |
response_config | the global configuration of response. |
[] empty array |
Anything unclear or inaccurate? Please let me know at axioscros@aliyun.com