Home>Article>PHP Framework> How to combine Yii2 and Workerman
Related recommendations: "workerman Tutorial"
Put the content in the index.php of the Yii2 application in front of the Worker code, just to Change run to init:
init(); //改为init
You can also continue to use the component method and directory structure of Yii2. Pay attention to a few points:
1. The debug component does not need to be loaded, and loading is meaningless because there is no request, so an error will be reported
2. It is best to define an index.php as the entrance to the entire workerman, so that some global variables such as YII_DEBUG can be initialized before main.php is loaded.
The above is the detailed content of How to combine Yii2 and Workerman. For more information, please follow other related articles on the PHP Chinese website!