• ? bcompiler_write_constant
  • bcompiler_write_file ?
  • 锟斤拷锟斤拷学院 www.cainiaoplay.com
  • PHP Manual
  • bcompiler 锟斤拷锟斤拷
  • 写锟诫开始位锟斤拷锟皆硷拷 exe 锟斤拷锟斤拷锟侥硷拷锟侥斤拷尾锟脚猴拷

bcompiler_write_exe_footer

(PECL bcompiler >= 0.4)

bcompiler_write_exe_footer — 写锟诫开始位锟斤拷锟皆硷拷 exe 锟斤拷锟斤拷锟侥硷拷锟侥斤拷尾锟脚猴拷

说锟斤拷

bcompiler_write_exe_footer ( resource $filehandle , int $startpos ) : bool

一锟斤拷 EXE锟斤拷锟斤拷锟斤拷锟街达拷校锟斤拷募锟斤拷锟� 3 锟斤拷锟斤拷锟斤拷桑锟�

  • The stub 锟斤拷锟斤拷执锟叫达拷锟诫,锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟� c 锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷 PHP 锟斤拷锟斤拷锟斤拷锟斤拷bcompiler 锟斤拷展锟斤拷锟斤拷锟斤拷锟斤拷纸锟斤拷氩拷锟绞硷拷锟斤拷锟斤拷锟街革拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟� main锟斤拷 锟斤拷锟斤拷姆锟斤拷锟斤拷锟斤拷锟斤拷锟� main::main锟斤拷锟斤拷
  • 锟街斤拷锟诫(锟斤拷锟斤拷锟斤拷时未压锟斤拷锟斤拷
  • bcompiler 锟斤拷 EXE 尾锟斤拷

为锟剿得碉拷锟绞合碉拷 stub 锟斤拷锟斤拷员锟斤拷锟轿伙拷锟� bcompiler CVS examples/embed 目录锟斤拷 锟斤拷锟斤拷 php_embed 锟斤拷 stub phpe.c锟斤拷

锟斤拷锟斤拷

filehandle

fopen()锟斤拷锟截碉拷一锟斤拷锟侥硷拷锟斤拷锟斤拷锟�

startpos

锟街斤拷锟斤拷锟斤拷锟侥硷拷锟叫匡拷始锟斤拷位锟矫o拷锟斤拷锟斤拷通锟斤拷 ftell() 锟斤拷取锟斤拷

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷

Example #1 bcompiler_write_exe_footer() 锟斤拷锟斤拷

<?php

/* 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷募锟斤拷锟絜xample.exe锟斤拷 */
$fh = fopen("example.exe", "w");

/* 1) 写锟斤拷一锟斤拷 stub 锟斤拷phpe.exe锟斤拷 */
$size = filesize("phpe.exe");
$fr = fopen("phpe.exe", "r");
fwrite($fh, fread($fr, $size), $size);
$startpos = ftell($fh);

/* 2) 写锟斤拷锟街斤拷锟斤拷 */
bcompiler_write_header($fh);
bcompiler_write_class($fh, "myclass");
bcompiler_write_function($fh, "main");
bcompiler_write_footer($fh);

/* 3) 写锟斤拷 EXE 尾锟斤拷 */
bcompiler_write_exe_footer($fh, $startpos);

/* 锟截憋拷锟斤拷锟斤拷锟斤拷募锟� */
fclose($fh);
?>

注锟斤拷

Warning

锟剿猴拷锟斤拷锟斤拷实锟斤拷锟斤拷锟侥★拷锟剿猴拷锟斤拷锟侥憋拷锟襟,帮拷锟斤拷锟斤拷锟狡硷拷锟斤拷锟斤拷锟斤拷牡锟斤拷锟斤拷锟斤拷锟斤拷锟轿达拷锟斤拷锟� PHP 锟斤拷锟斤拷锟芥本锟斤拷未通知锟酵憋拷锟睫改★拷使锟矫憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆碉拷 锟斤拷

锟轿硷拷

  • bcompiler_write_header() - 写锟斤拷 bcompiler 头
  • bcompiler_write_class() - 写锟诫定锟斤拷锟斤拷锟斤拷锟斤拷锟街斤拷锟斤拷
  • bcompiler_write_footer() - 写锟诫单锟斤拷锟街凤拷 \x00 锟斤拷锟节憋拷识锟斤拷锟斤拷锟斤拷锟捷的斤拷尾