Source for file example_modes.php
Documentation is available at example_modes.php
require_once 'Stream/Var.php';
$varname = 'var://_GET/foo';
echo "_GET variables:<pre>";
echo " <strong>open '$varname' with mode 'r':</strong><br>";
echo "This should fail, as the variable does not exist.<br>";
$fp = fopen($varname, "r");
echo "<br>_GET variables:<pre>";
echo " <br><strong>open '$varname' with mode 'w':</strong><br>";
echo "This should work, as the 'w' creates the variable.<br>";
$fp = fopen($varname, "w");
echo "writing data to the variable.<br>";
echo "<br>_GET variables:<pre>";
echo " <br><strong>open '$varname' with mode 'a+':</strong><br>";
echo "This will append data to a variable or create.<br>";
$fp = fopen($varname, "a+");
echo "writing data to the variable.<br>";
echo "read data: ". $data. "<br>";
echo "<br>_GET variables:<pre>";
echo " <br><strong>open '$varname' with mode 'x':</strong><br>";
echo "This should fail, as the variable does exist and 'x' wants to create a new file.<br>";
$fp = fopen($varname, "x");
echo "<br>_GET variables:<pre>";
Documentation generated on Mon, 11 Mar 2019 15:32:46 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|