【问题标题】:PHP Is there any way to implement windows cmd /b into php?PHP 有没有办法将 windows cmd /b 实现到 php 中?
【发布时间】:2015-02-03 16:45:10
【问题描述】:

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

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

【问题讨论】:

  • fread/fwrite 在使用标志 rb 打开的资源上。

标签: php cmd binary implementation


【解决方案1】:
<?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

【讨论】:

    猜你喜欢
    • 2012-04-13
    • 1970-01-01
    • 2020-03-03
    • 1970-01-01
    • 1970-01-01
    • 2011-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多