I l@ve RuBoard Previous Section Next Section

apache_note

mixed apache_note(string key, [string value]) 

key

Name of the note entry

value

Value of the note entry

Gets or sets Apache note entries.

Returns:

Value of the Apache note corresponding to the key specified as the first argument; FALSE if no entry was found for the specified key

Description:

Apache maintains an internal notes table—a simple list of key/value pairs—for every request; with this function, you can get and set entries from this table. The notes table will be flushed as soon as the request has been processed.

To set a new notes entry, specify its name as the first argument and its value as the second. If you leave out the second argument, the function returns the contents of the notes entry corresponding to the non-case-sensitive key specified as the first argument. If no matching entry is found, the function returns FALSE. Note that if you set an entry, the function returns the value of the old entry, if one was found, or FALSE otherwise.

apache_note() is helpful in passing information between modules that operate at different stages of the request. For example, it could be used for logging: You could create an Apache note entry listing the currently logged-in user and include the username in the server logs using mod_log_config with a custom directive such as "%{username}n".

Version:

Existing since version 3.0.2

Warning:

In versions prior to 3.0.3, apache_note() corrupted memory and produced segfaults in some circumstances.


Example:

Set an Apache notes entry listing the currently logged-in user
apache_note("username", $PHP_REMOTE_USER); 
    I l@ve RuBoard Previous Section Next Section