PHP Classes

File: example.php

Recommend this page to a friend!
  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: 18 years ago
Size: 709 bytes
 

Contents

Class file image Download
<?php
//include the class source
include("background_class_inc.php");

//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("john.doe@example.com","Your Script","The really long running process that you requested is complete!");

?>