bcompiler_write_exe_footer -- 写入起始址码信息用于标示一个可执行文件的结尾
描述
警告 |
这个函数是
试验性质的。 这意味着基于这些函数上的所有操作,这些函数名,包括所有发布在这里的文档都有可能在不做任何提示的情况下在将来正式发布时发生变动。如果要使用这个模块,请自负风险。 |
一个 EXE执行 (或自执行) 文件包括3个部分:
可执行代码(例如一个编译好的 C 程序可以启动 PHP 字节码编译器) |
用 Bzip 编译的字节码 |
编译器文件尾 |
起始址是一个文件中 Bzip 编译字节码开始的地方,可以使用
ftell($fh) 方法获得
例 1. bcompiler_write_footer() 举例 <?php
$fh = fopen("/tmp/example.exe","w");
$size = filesize("/tmp/base.exe");
$fr = fopen("/tmp/base.exe","r");
fwrite($fh,fread($fr,$size),$size);
$startpos = ftell($fh);
/* write bytecodes compressed */
$fz = bzopen($fh,"w");
bcompiler_write_header($fz);
bcompiler_write_class($fz,"DB");
bcompiler_write_class($fz,"DB_common");
bcompiler_write_footer($fz);
/* write footer exe uncompressed */
bcompiler_write_exe_footer($fh,$startpos);
fclose($fh);
?> |
|
请参阅:bcompiler_write_header() bcompiler_write_class(), bcompiler_write_footer().