Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1
Flag Description

ASSERT_ACTIVE (^) Asserts are ignored unless activated with this option.
ASSERT_BAIL (^) Exits the script if assertion fails. FALSE by default.
ASSERT_CALLBACK Registers a function to be called on failure. No function is
registered by default.
ASSERT_QUIET_EVALPrints the expression passed to assert. FALSE by default.
ASSERT_WARNING (^) Prints a regular PHP warning message. TRUE by default.
value call_user_method(string method, string object, ...)
Use call_user_method to execute a method defined in an object. You are required to
name a method and an object. Any arguments to pass to the method follow.
closelog()
The closelog function closes any connection to the system log. Calling it is optional, as
PHP will close the connection for you when necessary. See syslog for an example of
use.
boolean connection_aborted()
Use connection_aborted to test if a request for your script was aborted. The user may
do this by clicking the stop button on the browser, or closing the browser completely.
Ordinarily your script will stop execut- ing when aborted. However, you may change this
behavior with the ignore_user_abort function. You can also set abort handling using
commands in php.ini or with an Apache directive.
<?
//allow script continuation if aborted
ignore_user_abort(TRUE);
//fake a long task
sleep(20);
//check for abort
if(connection_aborted())
{
//write to log that the process was aborted
openlog("TEST", LOG_PID | LOG_CONS, LOG_USER);
syslog(LOG_INFO, "The fake task has been aborted!");
closelog();
}
else
{
print("Thanks for waiting!\n");
}
?>

Free download pdf