add windows development support

This commit is contained in:
crazywhalecc 2022-08-22 13:35:07 +08:00
parent 86c2cf96a9
commit fe3bb22311
4 changed files with 10 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class Framework
public const VERSION_ID = 614; public const VERSION_ID = 614;
/** @var string 版本名称 */ /** @var string 版本名称 */
public const VERSION = '3.0.0-alpha2'; public const VERSION = '3.0.0-alpha3';
/** @var array 传入的参数 */ /** @var array 传入的参数 */
protected $argv; protected $argv;
@ -253,6 +253,10 @@ class Framework
{ {
switch ($driver = ZMConfig::get('global.driver')) { switch ($driver = ZMConfig::get('global.driver')) {
case 'swoole': case 'swoole':
if (DIRECTORY_SEPARATOR === '\\') {
logger()->emergency('Windows does not support swoole driver!');
exit(1);
}
ZMConfig::$config['global']['swoole_options']['driver_init_policy'] = DriverInitPolicy::MULTI_PROCESS_INIT_IN_MASTER; ZMConfig::$config['global']['swoole_options']['driver_init_policy'] = DriverInitPolicy::MULTI_PROCESS_INIT_IN_MASTER;
$this->driver = new SwooleDriver(ZMConfig::get('global.swoole_options')); $this->driver = new SwooleDriver(ZMConfig::get('global.swoole_options'));
$this->driver->initDriverProtocols(ZMConfig::get('global.servers')); $this->driver->initDriverProtocols(ZMConfig::get('global.servers'));

View File

@ -52,7 +52,7 @@ class FileSystem
} elseif (is_file($sub_file) || is_dir($sub_file) && !$recursive && $include_dir) { } elseif (is_file($sub_file) || is_dir($sub_file) && !$recursive && $include_dir) {
# 如果是 文件 或 (是 目录 且 不递推 且 包含目录) # 如果是 文件 或 (是 目录 且 不递推 且 包含目录)
if (is_string($relative) && mb_strpos($sub_file, $relative) === 0) { if (is_string($relative) && mb_strpos($sub_file, $relative) === 0) {
$list[] = ltrim(mb_substr($sub_file, mb_strlen($relative)), '/'); $list[] = ltrim(mb_substr($sub_file, mb_strlen($relative)), '/\\');
} elseif ($relative === false) { } elseif ($relative === false) {
$list[] = $sub_file; $list[] = $sub_file;
} }

2
zhamao-server.bat Normal file
View File

@ -0,0 +1,2 @@
@echo off
php .\src\entry.php server --driver=workerman

2
zhamao.bat Normal file
View File

@ -0,0 +1,2 @@
@echo off
php .\src\entry.php %1 %2 %3 %4 %5 %6 %7 %8 %9