This post was last edited by KERICW on 2013-11-01 15:37:40
PHP Callback Callback PHP
I more vegetables, I ask you chevalier, how to achieve Eventstack in PHP Notifywatcher method can be obtained data back to the welcome.php specified callback function, where I write the wrong ah???
The error that appears is: Fatal error:function name must be a string in/home/latel/workspace/new_zhebo/module/eventstack.php on Linexx
/app/welcome.php
Addevent ("Data_request", Serialize (Array ("REQUEST" = "Settingdaemon")), $fGetSettings, null);? >
/eventstack.php
_aeventstack[] = Array ("Stamp") and $sStamp, "value" and "handler" and $fHandler, "Scope" and "$mScope" Timestamp "= time ()), $iKey = sizeof ($this->_aeventstack)-1; $this->notifywatcher ($iKey); return $iKey;} Public Function Addwatcher ($oWatcher, $sWatchStamp) {}# #C # #public function Cleareventstack () {//empty event stack}# #E # #public function Exporteventstack () {//Output debug Information}# #G # #public function Getstack ($iStackId) {//returns the stack list or the contents of the specified stack based on whether a stack ordinal is supplied}# #N # # Private Function Notifywatcher ($iKey) {//push event to the appropriate observer 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 you specify a callback function, depending on the data returned by the observer, make a specific action if (Isset ($this->_ aeventstack[$iKey] ["Fhandler"]) && $mCallback) {$func = $this->_aeventstack[$iKey] [Fhandler];$func ($mCallback);} else {$func (null);}}} # #R # #public function Removewatcher ($sWatchStamp) {//Removes the specified observer}}?>
Reply to discussion (solution)
See only once $fGetSettings
See only once $fGetSettings
Moderator, can say the details, I read your answer is not very understand.
I want to do it now,
The welcome.php page registers the callback function in Eventstack with the Eventstack->addevent method, and takes the data into the registered callback function after eventstack obtains the corresponding data.
I am not very good at language expression.
Do you mean global $fGetSettings?
Function name must be a string
Function name must be a string
You did not give the wrong position, I also bad guess!
Since $fGetSettings is a closed bag, where do you have to use him?
But the code snippet you're giving is not
Function name must be a string
Function name must be a string
You did not give the wrong position, I also bad guess!
Since $fGetSettings is a closed bag, where do you have to use him?
But the code snippet you're giving is not
Error line on line 72nd of eventstack.php
The closure function is passed to the 37 line of eventstack.php
The closure is treated as a parameter and is saved to the private array property of the object ($EventStack) in $_aeventstack.
$EventStack The data is fetched, it is re-fetched from the array in 72 rows, and the obtained data is passed as a parameter to the function
Hehe, it seems that I am lack of the art of questioning.
Please help, or else the project will be here ...
I guess I can only rely on myself.