__halt_compiler

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

__halt_compiler 中斷編譯器的執(zhí)行

說明

__halt_compiler(): void

中斷編譯器的執(zhí)行。常用于在PHP腳本內(nèi)嵌入數(shù)據(jù),類似于安裝文件。

可以通過常量 __COMPILER_HALT_OFFSET__ 獲取數(shù)據(jù)開始字節(jié)所在的位置,且該常量僅被定義于使用了__halt_compiler的文件。

返回值

沒有返回值。

范例

示例 #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.)

注釋

注意:

__halt_compiler() 僅能夠在最外層使用。