downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.apache-note.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.apache.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.apache-note.php',
   
1 => 'apache_note',
  ),
 
'up' =>
  array (
   
0 => 'ref.apache.php',
   
1 => 'Apache Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.apache-lookup-uri.php',
   
1 => 'apache_lookup_uri',
  ),
 
'next' =>
  array (
   
0 => 'function.apache-request-headers.php',
   
1 => 'apache_request_headers',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.apache-note" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">apache_note</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">apache_note</span> &mdash; <span class="dc-title">Get and set apache request notes</span></p>

 </div>

 <a name="function.apache-note.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><b>apache_note</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$note_name</tt></span>
   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$note_value</tt></span>
  ] )</div>

  <p class="para rdfs-comment">
   This function is a wrapper for Apache&#039;s <i>table_get</i> and
   <i>table_set</i>. It edits the table of notes that exists
   during a request. The table&#039;s purpose is to allow Apache modules to
   communicate.
  </p>
  <p class="para">
   The main use for <b>apache_note()</b> is to pass information
   from one module to another within the same request.
  </p>
 </div>


 <a name="function.apache-note.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">note_name</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The name of the note.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">note_value</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The value of the note.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.apache-note.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If called with one argument, it returns the current value of note
   <i>note_name</i>. If called with two arguments, it
   sets the value of note <i>note_name</i> to
   <i>note_value</i> and returns the previous value of
   note <i>note_name</i>.
   If the note cannot be retrieved, <b><tt class="constant">FALSE</tt></b> is returned.
  </p>
 </div>


 <a name="function.apache-note.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 Passing information between PHP and Perl</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />apache_note</span><span style="color: #007700">(</span><span style="color: #DD0000">'name'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Fredrik&nbsp;Ekengren'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Call&nbsp;perl&nbsp;script<br /></span><span style="color: #0000BB">virtual</span><span style="color: #007700">(</span><span style="color: #DD0000">"/perl/some_script.pl"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">apache_note</span><span style="color: #007700">(</span><span style="color: #DD0000">"resultdata"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents programlisting">
<div class="perlcode"><pre class="perlcode"># Get Apache request object
my $r = Apache-&gt;request()-&gt;main();

# Get passed data
my $name = $r-&gt;notes(&#039;name&#039;);

# some processing

# Pass result back to PHP
$r-&gt;notes(&#039;resultdata&#039;, $result);</pre>
</div>
    </div>

   </div><p>
  </p>
  <p class="para">
   </p><div class="example">
    <p><b>Example #2 Logging values in access.log</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />apache_note</span><span style="color: #007700">(</span><span style="color: #DD0000">'sessionID'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">session_id</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents programlisting">
<div class="apachecode"><pre class="apachecode"># &quot;%{sessionID}n&quot; can be used in the LogFormat directive</pre>
</div>
    </div>

   </div><p>
  </p>
 </div>


 <a name="function.apache-note.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.virtual.php" class="function" rel="rdfs-seeAlso">virtual()</a> - Perform an Apache sub-request</li>
   </ul><p>
  </p>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites