2011-12-22 23:03


  • php

I have a php script, let's call it main_script.php and if you run it through a console it returns bunch of interesting data.

I have another script, let's call it second_script.php. in second_script.php I am using shell_exec command such as

$main_script = "php main_script.php --array=true";
$output = $shell_exec($main_script);

That will, however, return output from main_script.php

What if I want main_script.php return an array. Something like this

if ($con->console_parm['array'] ){
   $whatever = array("test"=> "data son!");
   return $whatever;

Is there a way I can execute it through second_script.php and get that array?!

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享