How correctly through exec () to transfer arguments to the script, and how to get them in the script? I did not understand the manual.

exec("php import.php >> import.log 2>&1 &", $data); 

    1 answer 1

    Here is the manual , what exactly is not clear?

    • And how to accept them in the script? I pass an array of $ data, how to accept it in a script? - forum3
    • In the same way as for any other program: script.php argument1 argument2 ... Well, or: exec ("script.php $ data [0] $ data [1] $ data [2] ...") Or: exec ("script.php" .base64_encode (json_encode ($ data))) Or ... No "$ data" arrays exist here, the script is considered in this context as a normal application. How to take in the script - it is written in the manual. - user6550
    • Aaaaa, i.e. in the script, the variable $ argv will be variable. Got it. Thank you :) - forum3
    • one
      For those who will look in the future. Use base64_encode (json_encode ($ data)). Since waste values ​​can be perceived wrong. - forum3