「求助」关于php回调函数的疑问
本帖最后由 kericw 于 2013-11-01 15:37:40 编辑 本人较菜,请问各位侠士,如何在php中达到eventstack的notifywatcher方法可以将取得的数据返还给welcome.php指定的回调函数,我哪里写的不对啊 ???
出现的错误为:fatal error: function name must be a string in /home/latel/workspace/new_zhebo/module/eventstack.php on line ××
/app/welcome.php
addevent(
data_request,
serialize(array(
array(
request => settingdaemon
)
)),
$fgetsettings,
null
);
?>
/eventstack.php
_aeventstack[] = array(
stamp => $sstamp,
value => $svalue,
handler => $fhandler,
scope => $mscope,
timestamp => time()
);
$ikey = sizeof($this->_aeventstack) - 1;
$this->notifywatcher($ikey);
return $ikey;
}
public function addwatcher($owatcher, $swatchstamp) {
}
##c##
public function cleareventstack() {
//清空事件堆栈
}
##e##
public function exporteventstack() {
//输出调试信息
}
##g##
public function getstack($istackid) {
//根据是否提供堆栈序号,返回堆栈列表或指定堆栈的内容
}
##n##
private function notifywatcher($ikey) {
//推送事件至相应的观察者
if (array_key_exists($this->_aeventstack[$ikey][stamp], $this->_awatcherregistry)) {
$mcallback = $this->_awatcherregistry[$this->_aeventstack[$ikey][stamp]](
$this->_aeventstack[$ikey][stamp],
$this->_aeventstack[$ikey][value],
$this->_aeventstack[$ikey][handler],
$this->_aeventstack[$ikey][scope]
);
//如果指定了回调函数,依据观察者返回的数据,做出具体的操作
if (isset($this->_aeventstack[$ikey][fhandler]) && !$mcallback) {
$func = $this->_aeventstack[$ikey][fhandler];
$func($mcallback);
} else {
$func(null);
}
}
}
##r##
public function removewatcher($swatchstamp) {
//移除指定的观察者
}
}
?>
php?回调 回调 php 分享到:
------解决方案--------------------
只看到一次 $fgetsettings