php - Pass method from controller as callback to another -
php - Pass method from controller as callback to another -
i have this:
public function generateaudio(){ $sourceprocessor = new sourceprocessor($_session['input_file']); $sourceprocessor->extractaudio(); } public function checkprogress($percent){ //do percents } and in sourceprocessor have this:
public function extractaudio($callback=null, $folder=null){ if(is_callable($callback)){ $callback($percentage); } } i tried pass method
$sourceprocessor->extractaudio(array($this,'checkprogress'); $sourceprocessor->extractaudio(array($this->checkprogress()); but nil seems work. have thought how this?
call method this:
$sourceprocessor->extractaudio(array($this,'checkprogress')); and phone call callback extractaudio this:
call_user_func($callback, $percent); see manual entry call_user_func , callable more information
php yii
Comments
Post a Comment