PHP有没有办法将windows cmd / b实现到php?

时间:2015-02-03 16:45:11

标签: php cmd binary implementation

有没有办法将windows cmd / b实现到php?

我的意思是,二进制文件加入。我尝试了很多(通过file_get_contents& file_put_contents),但它似乎不起作用......

1 个答案:

答案 0 :(得分:0)

<?php
$target = 'c:/temp/fileA.dat';
$sources = array(
    'c:/temp/file1.bin',
    'c:/temp/file2.dat',
    'c:/temp/file3.foo',
    'c:/temp/file4.'
);


foreach($sources as $src) {
    $fp = fopen($src, 'rb') or die('fopen failed...');
    file_put_contents($target, $fp, FILE_APPEND); 
}


http://docs.php.net/fopen
http://docs.php.net/file_put_contents