0

exec() を使用してファイルを実行しています。渡す必要がある引数の 1 つは文字列です。

shell_exec('/home/technoworld/Videos/LinSocket/client "Hi hello"');これはうまくいきます!

しかし、文字列を var ie $s="Hi hello" に取り込むと、

'shell_exec('/home/technoworld/Videos/LinSocket/client . "$s"')`. It does not works. If

'shell_exec('/home/technoworld/Videos/LinSocket/client . $s')' goes in infinite wait!

関数に $s を渡す方法はありますか?

4

2 に答える 2

1

あなたの最善の策は、escapeshellargコマンドを使用することです。

shell_exec('/home/technoworld/Videos/LinSocket/client '.escapeshellarg($s));
于 2013-07-08T18:56:32.787 に答える