PHP操作码缓存可以与__autoload一起使用吗? [英] Do PHP opcode cache work with __autoload?

查看:93
本文介绍了PHP操作码缓存可以与__autoload一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果这是基本知识,我想尽我所能学习有关PHP中的OO的知识,并且我正在慢慢学习如何使用它(非常有限).

Sorry if this is basic, I am trying to learn as much as I can about OO in PHP and I am slowly learning how to use it (very limited).

所以我想知道__autoload()是否对PHP操作码缓存有影响?

So I am wanting to know if __autoload() has any affect on PHP opcode cache's?

推荐答案

(免责声明:我只知道APC)

操作码缓存的作用是:

  • 包含/需要文件时,它将使用该文件的完整路径
  • 检查对应于该文件的操作码是否已经在RAM中(在操作码缓存中)
    • 如果是,则返回这些操作码,以便执行它们
    • 如果否,则加载文件并将其编译为操作码;并将操作码存储在缓存中.
    • when a file is included/required, it take the full path to that file
    • check if the opcodes corresponding to that file are already in RAM (in opcode cache)
      • if yes, return those opcode so they are executed
      • if no, load the file and compile it to opcodes ; and store opcodes in cache.

      这里的重点是入口点:文件的完整路径.

      The important point, here, is the entry point : the full path to the file.


      自动加载通常要做的是:


      What autoloading generally do is :

      • 获取课程名称
      • 将其转换为文件名
      • 包含/获取该文件

      因此,与操作码缓存相关的信息(文件的完整路径以及包含/必需的事实)仍在此处.

      So, the informations that are relevant for the opcode cache (full path to the file, and the fact that it is included/required) are still here.

      因此,自动加载不会给操作代码缓存带来任何麻烦.

      In consequence, autoload shouldn't bring any trouble with op code caching.

      (而且,据我所知,使用APC时不会)

      这篇关于PHP操作码缓存可以与__autoload一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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