ZKLibrary icon indicating copy to clipboard operation
ZKLibrary copied to clipboard

Disabling method before PHP processing

Open todpale opened this issue 7 years ago • 2 comments

Hello! Thank you very much for so helpful library! I have a question connecting with methods calling. I get the attendances and user data for variables. Can I enable and disconnect the device after this and then make the PHP array processing? For example, I have this code now:

       //connection here
        $data = $zk->getAttendance();
	$users = $zk->getUser();

	foreach($data as $key=>$value){
                 //processing        
         }

        $zk->enableDevice();
	$zk->disconnect();

I want to do like this:

        //connection here
        $data = $zk->getAttendance();
	$users = $zk->getUser();
        $zk->enableDevice();
	$zk->disconnect();

	foreach($data as $key=>$value){
                 //processing        
         }

Is it real? I would test this idea, but I work with frequently used gadget and don't want to interrupt its process :)

todpale avatar Sep 18 '18 06:09 todpale

$zk->disableDevice(); and $zk->enableDevice(); just to prevent device not responding when library read data from it. By invoke $zk->disableDevice(), user will wait until reading process finish. Because all user data have been read with $users = $zk->getUser(), you can disconnect before you process the data. User data have been stored on variable $user.

kamshory avatar Sep 25 '18 07:09 kamshory

@kamshory thanks a lot!

todpale avatar Sep 25 '18 19:09 todpale