Calling Perl script from PHP and passing in variables, while also using variablized perl script name

前端 未结 3 840
迷失自我
迷失自我 2020-12-02 02:17

I normally call perl scripts from PHP as below and pass in variables this way, and it works fine, however now I am building a component for re-use where I want to also varia

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 02:35

    In your second code, you're concatenating the variables without spaces between them. You should consider using sprintf to format this nicely:

    $script = sprintf('/var/www/other_scripts/perl/apps/%s.pl %s %s %s %s', $perlscript, $var1, $var2, $var3, $var4);
    

提交回复
热议问题