__halt_compiler

(PHP 5 >= 5.1.0, PHP 7)

__halt_compiler 中断编译器的执行

说明

__halt_compiler ( void ) : void

中断编译器的执行。常用于在PHP脚本内嵌入数据,类似于安装文件。

可以通过常量 __COMPILER_HALT_OFFSET__ 获取数据开始字节所在的位置,且该常量仅被定义于使用了__halt_compiler的文件。

返回值

没有返回值。

范例

Example #1 __halt_compiler() 例子

<?php

// open this file
$fp fopen(__FILE__'r');

// seek file pointer to data
fseek($fp__COMPILER_HALT_OFFSET__);

// and output it
var_dump(stream_get_contents($fp));

// the end of the script execution
__halt_compiler(); the installation data (egtargzPHPetc.)

注释

Note:

__halt_compiler() 仅能够在最外层使用。