summaryrefslogtreecommitdiff
path: root/documentation/variables.html
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-15 01:32:22 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-15 01:32:22 +0100
commit3300d64c4dd61e71b62d5b55b1f16e34d6335680 (patch)
treec2bd999ba1a2a1320acba20fb99acf0defb9651e /documentation/variables.html
parent681d1e6aa735568a492140d2307a89063e7aadb9 (diff)
parentcda98dc0dea7144941a46ff20598f3c095d7a6d0 (diff)
implemented __clone method
Diffstat (limited to 'documentation/variables.html')
-rw-r--r--documentation/variables.html22
1 files changed, 20 insertions, 2 deletions
diff --git a/documentation/variables.html b/documentation/variables.html
index 6b63598..b3f4330 100644
--- a/documentation/variables.html
+++ b/documentation/variables.html
@@ -286,7 +286,7 @@ std::cout &lt;&lt; array("Y-m-d H:i:s") &lt;&lt; std::endl;
<h2 id="global-variables">Global variables</h2>
<p>
To read or update global PHP variables, you can use the Php::GLOBALS
- variable. This variable works more or less the same as the $_GLOBALS
+ variable. This variable works more or less the same as the $GLOBALS
variable in a PHP script.
</p>
<p>
@@ -305,7 +305,25 @@ std::cout &lt;&lt; Php::GLOBALS["b"] &lt;&lt; std::endl;
</code></pre>
</p>
<p>
- Unlike PHP scripts, that handles only single pageviews, an extension is
+ Next to the $GLOBALS variable, PHP allows you to access variables using
+ the $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER, $_REQUEST and $_ENV variables.
+ In your C++ extension you can do something similar with the global variables
+ Php::GET, Php::POST, Php::COOKIE, Php::FILES, Php::SERVER, Php::REQUEST and
+ Php::ENV. These are global, read-only, objects with an overloaded operator[]
+ method. You can thus access them as if it were associative arrays.
+</p>
+<p>
+<pre class="language-c++"><code>
+// retrieve the value of a request variable
+int age = Php::REQUEST["name"];
+
+// or retrieve the value of a server variable
+std::string referer = Php::SERVER["HTTP_REFERER"];
+</code></pre>
+</p>
+<h2 id="global-natives">Be careful with global C++ variables</h2>
+<p>
+ Unlike PHP scripts, that only handle single pageviews, an extension is
used to handle multiple pageviews after each other. This means that when
you use global C++ (!) variables in your extension, that these variables are
not set back to their initial value in between the pageviews. The