can any开发者_如何学Go one please let me know, why i could not get result for the php function
exec('unzip gallery.zip',$return);
print_r($return);
Did you check the return value from unzip? Error messages are not given on standard output stream, so the array will be empty if something fails.
<?php
$result = array();
exec("unzip archiv.zip", $result, $returnval);
print_r($result);
print_r($returnval);
?>
Does the unzip work as expected? It might ask for overwriting etc. if the files already exist and stop the workflow. This output will not be captured in the result.
Have you initialized variable $return
before use?
Have you installed package unzip
if you're running Unix or Linux? (I'm not sure that you can do that on Windows)
Errors are written to stderr and aren't shown when using exec, backticks or shell_exec functions.
passthru() does output the error stream (as well as stdout).
Ps : Its probably either:
File not found: Does gallery.zip
exists in the cwd. Use absolute paths and escapeshellarg() te be sure.
or
File rights: Is php allowed to write the extracted files to the cwd or specified targetpath?
精彩评论