Home  >  Article  >  Backend Development  >  大牛们看看PHP调用外部命令win系统上删目录

大牛们看看PHP调用外部命令win系统上删目录

WBOY
WBOYOriginal
2016-06-13 10:46:36916browse

大牛们看看PHP调用外部命令win系统下删目录
本人xp环境下 待删目录为:D:\www\test\123456
123456目录下有子目录和文件
现在希望用php调用外部命令 删除123456这个目录 请各位大牛懂的给个demo

下面是本人写的 在命令行上执行那个命令 是可以删的 可以执行程序 每次运行都输出1 但是目录没变化 求大牛帮忙看下 跪谢

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpif (exec("cmd rd /s/q  D:\www\test\123456")) {    echo 1;} else {    echo 0;}?>



------解决方案--------------------
不用加cmd直接写命令
PHP code
$filepath = 'D:\www\test\123456';exec('rd /q /s '.$filepath);<div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn