-
-
Save amgraham/621683 to your computer and use it in GitHub Desktop.
Am easy way for an application to talk with itself.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Memo { | |
// we're going to set the message to something, could be nothing (meaning we want the message cleared), or something to else. | |
function set($message = '') { | |
if (setcookie('memo', $message, time() + 60, '/')) { | |
return false; | |
} else { | |
return true; | |
} | |
} | |
// we're retrieving the message, also setting it blank. | |
function get() { | |
//$memo = file_get_contents($this->storage); | |
$memo = $_COOKIE["memo"]; | |
Memo::delete(); | |
if ($memo != '') { | |
return stripslashes($memo); | |
} else { | |
return false; | |
} | |
} | |
// different from set, as we delete it | |
function delete() { | |
setcookie('memo', '', time() - 60, '/'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment