Merge pull request #151 from zhamao-robot/windows-support

修复对 Windows 环境开发的支持
This commit is contained in:
Jerry Ma 2022-08-22 15:45:57 +08:00 committed by GitHub
commit 172a7444c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 4 deletions

View File

@ -44,7 +44,7 @@ class Framework
public const VERSION_ID = 615;
/** @var string 版本名称 */
public const VERSION = '3.0.0-alpha2';
public const VERSION = '3.0.0-alpha3';
/** @var array 传入的参数 */
protected $argv;
@ -253,6 +253,10 @@ class Framework
{
switch ($driver = ZMConfig::get('global.driver')) {
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;
$this->driver = new SwooleDriver(ZMConfig::get('global.swoole_options'));
$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) {
# 如果是 文件 或 (是 目录 且 不递推 且 包含目录)
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) {
$list[] = $sub_file;
}

View File

@ -10,11 +10,10 @@ use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\ParameterType;
use PDO;
use PDOException;
use Swoole\Database\PDOProxy;
class MySQLConnection implements Connection
{
/** @var PDO|PDOProxy */
/** @var PDO */
private $conn;
private $pool_name;

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 %*