PHP - 如何存储资源供以后使用

时间:2017-01-04 20:28:23

标签: php

我想存储proc_exe中的资源供以后使用。这样我可以与开放进程通信......但似乎它无法存储在$ _SESSION中,有没有人知道如何存储它?

 session_start();
if(is_resource($_SESSION['process']))
{
  echo "I was here";
  proc_close($_SESSION['process']);
}
else
{
  $descriptorspec = array(
     0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
     1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
     2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
  );
  $_SESSION['process'] = proc_open("myProgram", $descriptorspec, $p, null, null);
  if(is_resource($_SESSION['process']))
  {
    echo "<pre>";
      print_r($_SESSION); //Untill here everything of
    echo "</pre>";
  }
}

谢谢

0 个答案:

没有答案