如何zend引擎编译PHP代码或PHP编译器如何工作? [英] How zend engine compile php codes or How php compiler works?

查看:211
本文介绍了如何zend引擎编译PHP代码或PHP编译器如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi任何机构知道如何zend引擎编译php代码。
例如。在java中,我们的代码被编译为字节代码,之后它转换为机器语言。像明智的zend引擎如何编译php代码?请帮我。

Hi any body knows how the zend engine compiles php codes. For eg. in java our codes are compiled to byte code after that it converts to machine language. like wise how zend engine compile php codes? Kindly help me.

推荐答案

这与PHP有点相同:


  • 第一步:将PHP源代码(即某些文本)编译为一组操作码

  • 第二步:操作码被执行。



默认情况下,每次PHP脚本


This compilation, by default, is done each time a PHP script is to be executed -- which takes some CPU.

这是你可以使用一些操作码缓存的原因(例如 APC扩展,将操作码存储在内存中 - 避免冗余编译步骤。

That is the reason for which you can use some opcode cache (like the APC extension), to store the opcodes in memory -- avoiding the redundant compilation step.



您将能够在Sebastian Bergmann的以下演示中找到一些有关这些过程的有趣信息: PHP编译器内部

这篇关于如何zend引擎编译PHP代码或PHP编译器如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆