xajax的注册函数如下function deal($form,$type)
{
$objResponse=new xajaxResponse();
$objResponse->alert( "formData: " . print_r( $form, true ) );
//其他代码
return $objResponse;
}如果我在其他代码出不加入任何代码,很正常,会弹出alert框
但是如果我在其他代码处加上一些特定的代码: $proc = new proc_mgr();
if( !$proc->init() )
{
$objResponse->assign( "testdiv", "innerHTML", "init failed!");
return $objResponse;
}
$proc->cmd("start 0");具体的proc_mgr如下class proc_mgr
{
private $process;
private $descriptorspec;
private $pipes;
private $quit;
private $sp;
public function __construct()
{
$this->sp = CMD_BR;
$this->quit = CMD_QUIT.CMD_BR;
$this->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", PCC_DIR."/webpcc-err-log.txt","a") // stderr is a file to write to
);
//stream_set_blocking ( $this->descriptorspec, true);
}
public function __destruct()
{
release();
}
public function init()
{
$this->process = proc_open(PCC_EXE, $this->descriptorspec,$this->pipes,PCC_DIR);
if( !is_resource($this->process) )
{
return false;
}
return true;
}
public function release()
{
return proc_close($this->process);;
}
public function quitproc()
{
fwrite($this->pipes[0], $this->quit);
fclose($this->pipes[0]);
while ( !feof($this->pipes[1]) )
{
$result .= stream_get_contents($this->pipes[1]);
}
fclose($this->pipes[1]);
return $result;
}
public function cmd($strcmd)
{
$cmds = $strcmd.$this->sp.$this->quit;
fwrite($this->pipes[0], $cmds);
fclose($this->pipes[0]);
$result = "";
while ( !feof($this->pipes[1]) )
{
//$result = $this->fgets($this->pipes[1], 4096);
$result .= stream_get_contents($this->pipes[1]);
//echo $result;
}
fclose($this->pipes[1]);
return $result;
}
public function cmds($listcmd)
{
$count = count($listcmd);
for( $i=0; $i<$count; ++$i )
{
$cmd .= $listcmd[$i];
$cmd .= $this->sp;
}
$cmd .= $this->quit;
return $this->cmd($cmd);
}
}也就是只要加入了proc_mgr相关代码后,xajaxResponse的所有方法(alert assign)都失效了,求高手解答,万分感谢
{
$objResponse=new xajaxResponse();
$objResponse->alert( "formData: " . print_r( $form, true ) );
//其他代码
return $objResponse;
}如果我在其他代码出不加入任何代码,很正常,会弹出alert框
但是如果我在其他代码处加上一些特定的代码: $proc = new proc_mgr();
if( !$proc->init() )
{
$objResponse->assign( "testdiv", "innerHTML", "init failed!");
return $objResponse;
}
$proc->cmd("start 0");具体的proc_mgr如下class proc_mgr
{
private $process;
private $descriptorspec;
private $pipes;
private $quit;
private $sp;
public function __construct()
{
$this->sp = CMD_BR;
$this->quit = CMD_QUIT.CMD_BR;
$this->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", PCC_DIR."/webpcc-err-log.txt","a") // stderr is a file to write to
);
//stream_set_blocking ( $this->descriptorspec, true);
}
public function __destruct()
{
release();
}
public function init()
{
$this->process = proc_open(PCC_EXE, $this->descriptorspec,$this->pipes,PCC_DIR);
if( !is_resource($this->process) )
{
return false;
}
return true;
}
public function release()
{
return proc_close($this->process);;
}
public function quitproc()
{
fwrite($this->pipes[0], $this->quit);
fclose($this->pipes[0]);
while ( !feof($this->pipes[1]) )
{
$result .= stream_get_contents($this->pipes[1]);
}
fclose($this->pipes[1]);
return $result;
}
public function cmd($strcmd)
{
$cmds = $strcmd.$this->sp.$this->quit;
fwrite($this->pipes[0], $cmds);
fclose($this->pipes[0]);
$result = "";
while ( !feof($this->pipes[1]) )
{
//$result = $this->fgets($this->pipes[1], 4096);
$result .= stream_get_contents($this->pipes[1]);
//echo $result;
}
fclose($this->pipes[1]);
return $result;
}
public function cmds($listcmd)
{
$count = count($listcmd);
for( $i=0; $i<$count; ++$i )
{
$cmd .= $listcmd[$i];
$cmd .= $this->sp;
}
$cmd .= $this->quit;
return $this->cmd($cmd);
}
}也就是只要加入了proc_mgr相关代码后,xajaxResponse的所有方法(alert assign)都失效了,求高手解答,万分感谢
解决方案 »
- 求jquery页面分析
- 怎么加了background-image高度就有问题
- 菜单很多,超出了页面的宽度,怎么实现:没有IE滚动条,在鼠标放到菜单边缘时滚动显示后面的菜单,鼠标离开停止滚动。当然,要左右两边都
- 纠正js脚本错误!
- javascript如何实现两个不同页面链接到同一页面,再点击此页面的同一按钮返回各自页面,在线等
- 那里有象createtextrange()函数的说明?
- 高分请教:如何用javasript打开一个新的ie窗口,要求指定超链接胡“Target”参数,如"_self"
- javascript的巨难问题,动态生成html控件,如:select;动态控件还要能触发事件,如:selectindexchanged
- “层”是透明的 如何弄成不透明的。
- 关于获取页面元素的正则表达式
- 检查ASP控件中的值得问题
- 下面两种JS代码写法有什么不同?为什么出来效果不一样?
这里没通过,就是$proc->init() == false
public function init()
{
$this->process = proc_open(PCC_EXE, $this->descriptorspec,$this->pipes,PCC_DIR);
if( !is_resource($this->process) )
{
return false;
}
return true;
}检查这里的proc_open是不是有问题
而第二段代码中 return $objResponse; 被放在条件分支里现在用 xajax 的不多了,没有环境也说不出什么