简体   繁体   English

PHP Shell_Exec无法使用变量

[英]PHP Shell_Exec not working with variable

I'm trying to pass a variable into shell_exec, I've looked at other tutorials but they still dont help. 我正在尝试将变量传递给shell_exec,我看过其他教程,但它们仍然无济于事。

I want to pass $var[1] into the shell_exec so it will just display this specific file or directory's information 我想将$ var [1]传递到shell_exec中,这样它将只显示此特定文件或目录的信息

$output = shell_exec('ls -l'.$var[1]);

You should add some whitespace: 您应该添加一些空格:

$output = shell_exec('ls -l '.$var[1]);
                        // ^here

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM