php中的Linux命令
我正在使用诸如“rm-f”之类的linux命令,或者通过PHPShell\uExec执行一些exe,但该命令的工作方式与linux命令行不同。有什么问题吗?提前谢谢php中的Linux命令,php,linux,Php,Linux,我正在使用诸如“rm-f”之类的linux命令,或者通过PHPShell\uExec执行一些exe,但该命令的工作方式与linux命令行不同。有什么问题吗?提前谢谢 $myfile = fopen("preOrder.txt", "w") or die("Unable to open file!"); if (isset($_POST['submit'])) { $strg = $_POST['myText']; fwrite($myfile, $strg); fc
$myfile = fopen("preOrder.txt", "w") or die("Unable to open file!");
if (isset($_POST['submit'])) {
$strg = $_POST['myText'];
fwrite($myfile, $strg);
fclose($myfile);
$lyparser_log=shell_exec('./lyparser.out < preOrder.txt');
$file1=fopen("log.txt","w");
fwrite($file1,$lyparser_log);
}
$myfile=fopen(“preOrder.txt”,“w”)或die(“无法打开文件!”);
如果(isset($_POST['submit']){
$strg=$_POST['myText'];
fwrite($myfile,$strg);
fclose($myfile);
$lyparser_log=shell_exec('./lyparser.out
您可以在PHP中这样执行:
$yourCommand = ""; // use your command here like **rm -f**
shell_exec($yourCommand); // or any other command pass in this function.
来自PHP手册:
此函数将通过shell执行命令,并以字符串形式返回完整的输出
旁注:如果您拥有所有权限,但此函数仍然不起作用,请检查您的
PHP.INI
文件,并从禁用函数中删除shell_exec
是否可以发布您的代码片段?@LawrenceJohnson If(isset($\u post['submit']){$strg=$\u post['myText'];fwrite($myfile,$strg);fclose($myfile);$lyparser_log=shell_exec('./lyparser.out