How to programmatically check if running on HHVM?

偶尔善良 提交于 2019-11-30 06:06:47

You can utilise the constant HHVM_VERSION specific to HHVM:

if (defined('HHVM_VERSION')) {
    // Code
}

You can put this in your own function if you want.

function is_hhvm() {
    return defined('HHVM_VERSION');
}

if (is_hhvm()) {
    // Code
}

Source: http://www.hhvm.com/blog/2393/hhvm-2-3-0-and-travis-ci

Some older versions of HHVM don't have HHVM_VERSION defined. They all output "HipHop" in phpinfo().

function is_hhvm(){
  ob_start();
  phpinfo();
  $info=ob_get_contents();
  ob_end_clean();
  return ($info=='HipHop');
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!