PHP Classes

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Paul Scott  >  Backgrounder  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Script
Class: Backgrounder
Call background processes
Author: By
Last change: Added better comments to the example script
Date: 9 years ago
Size: 709 bytes


Class file image Download
//include the class source

//instantiate a new object
$b = new background;

//check the users connection status,
//only needs to be done once, then it becomes internal
$status = $b->isUserConn();

//keep the user connection alive, even if browser is closed!
$callback = $b->keepAlive();

//this is where you would call your code that takes a long time to execute
sleep(60); //fake the long process - a 60 second process

//fork the process, and create the child process
//call the callback function when done!
$call2 = $b->setCallback("","Your Script","The really long running process that you requested is complete!");