如果你想知道PHP是否有编译内置函数来编译PHP代码,没有。PHP是一种解释语言,PHP代码需要解释器来运行,解释器有它的执行环境。在
但是,如果你想实现你的要求,这里有一些方法可以实现它:phc is an open source compiler for PHP with support for plugins. In addition, it can be used to pretty-print or obfuscate PHP code, as a framework for developing applications that process PHP scripts, or to convert PHP into XML and back, enabling processing of PHP scripts using XML tools.To encode entire script in a proprietary PHP application
To encode some classes and/or functions in a proprietary PHP application
To enable the production of php-gtk applications that could be used on client desktops, without the need for a php.exe.
To do the feasibility study for a PHP to C converter
它支持PHP编译。在