__halt_compiler 中断编译器的执行

发表日期:2021-07-01 10:15:42 | 来源: | | 浏览(521) 分类:杂项 函数

__halt_compiler

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

__halt_compiler 中断编译器的执行

说明

__halt_compiler(): void

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

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

返回值

没有返回值。

范例

示例 #1 __halt_compiler() 例子

<?php 
// open this file$fp = fopen(__FILE__, 'r');
// seek file pointer to datafseek($fp, __COMPILER_HALT_OFFSET__);
// and output itvar_dump(stream_get_contents($fp));
// the end of the script execution__halt_compiler();
 the installation data (eg. tar, gz, PHP, etc.)

注释

注意:

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

集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。