diff --git a/README.md b/README.md index 44566d9a..c172fc4a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ - 需要 GCC-9 以上版本,支持 C++17 标准 - 需要 CMake-3.24 以上版本 +> 预览版目前仅支持 `Linux` 系统,建议使用 `Ubuntu 22.04` + ## PHP 必须包含 embed 模块 @@ -11,7 +13,7 @@ 进入 `vendor/swoole/phpx` 目录,编译 `phpx` ```shell -vendor/swoole/phpx +cd vendor/swoole/phpx cmake . make -j32 ``` diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index f2f730d7..1092a3dc 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -158,7 +158,7 @@ class CompilerBase extends \PhpAot\Core\Translator protected string $ldflags = ''; protected int $floatPrecision = 17; protected bool $debugInfo = false; - protected bool $formatCode = false; + protected bool $formatCode = true; protected bool $printBacktraceOnError = false; protected bool $noLiteralStrings = false; protected string $file; diff --git a/src/Php/Translator.php b/src/Php/Translator.php index aeec5a92..c2ae1a36 100644 --- a/src/Php/Translator.php +++ b/src/Php/Translator.php @@ -484,7 +484,7 @@ CODE; $code .= '// register constants' . PHP_EOL; foreach ($this->constants as $name => $const) { $code .= "{$name} = {$const->value};\n"; - $code .= 'php::define(' . $this->genCharPtr($const->name) . ', ' . $name . ');' . PHP_EOL; + $code .= 'php::define(' . $this->genCharPtr($const->name, true) . ', ' . $name . ');' . PHP_EOL; } $code .= '// global vars ' . PHP_EOL; foreach ($this->globalVars as $name => $type) {