Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><head><title>Request Processed</title></head><body>
- <?php
- class Dog {
- var $name;
- }
- class Adoption
- {
- var $dog;
- function Display()
- {
- echo $dog->name;
- }
- }
- function save($adoption)
- {
- file_put_contents("../adoptions/adoptions.txt", (serialize($adoption)."<!-- E -->"));
- }
- function loadAdoptions()
- {
- $filename = '../adoptions/adoptions.txt';
- if (file_exists($filename))
- {
- $datain = file_get_contents($filename);
- $out = explode("<!-- E -->", $datain);
- echo "<br /><u>Retrieved Data</u><br />";
- $count = count($out);
- echo 'Count: '.$count;
- for ($i = 0; i < $count; $i++)
- {
- $curAdoption = unserialize($out[i]);
- if (curAdoption)
- echo $curAdoption->Display();
- else
- echo 'Error Reading Record.';
- echo '<br />';
- }
- }
- }
- $newDog = new Dog();
- $newDog->name = "Scruffles";
- $newAdoption = new Adoption();
- $newAdoption->dog = newDog;
- save(newAdoption);
- loadAdoptions();
- ?>
- </body></html>
Add Comment
Please, Sign In to add comment