duanping3587 2014-02-20 07:16
浏览 59
已采纳

从PHP传递'>'符号到PERL

I would like to use PHP to pass two values (I get from a php form) into a perl script in order to process these. I am able to do this just fine with all characters but not the '>' sign, what can I do to repair this..?

This is my php code:

<?php   
    $val="$_POST['val']";
    $val2="$_POST['val2']";
      system("/usr/bin/perl script.pl $val $val2",$retval); 
    if($retval!=0){
        echo ("<p> There was an unknown error.");
    }
?>

Thanks!

  • 写回答

2条回答 默认 最新

  • dpbv85276 2014-02-20 07:56
    关注

    As @po_taka already mentioned you need to sanitize $_POST data, use this the PHP function escapeshellarg.

    system("/usr/bin/perl script.pl ".escapeshellarg($val)." ".escapeshellarg($val2),$retval);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?