I need to run one of my CI scripts on the command-line. I need to pass an array to the controller to then pass to the script. Here's what I've got right now:
$params = array(
'a' => var1,
'b' => var2
);
Then the cmd running is:
php index.php process process_opk params
In my controller, just to see how/if the array is coming through properly I have:
public function index($args) {
print_r($args);
}
and the output of this is params as a string.
Do I need to serialize my array first before sending it? I guess CLI changes how variables are passed through CLI, am I wrong? If anyone could elaborate on this and demonstrate best practice, that would be great. Thanks!
Update: Best solution I could find so far is to base64_encode the serialized data and send it as a long string. Then in the controller decode and unserialize and send the array to my script.