Skip to content

Instantly share code, notes, and snippets.

@easychen
Created December 9, 2018 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save easychen/f7ecbeefe59063d6bc6c422724f2e9d5 to your computer and use it in GitHub Desktop.
Save easychen/f7ecbeefe59063d6bc6c422724f2e9d5 to your computer and use it in GitHub Desktop.
分组存储
<?php
if( preg_match("/:save\s(.+?)$/i" , $cmd , $out ) )
{
file_put_contents( "saestor://todo/ttd-easy-". md5($out[1]) .".json" , v('todos') );
$ret['js'] = "alert('Saved to ". $out[1] ." 🤠 ')";
}
elseif( preg_match("/:load\s(.+?)$/i" , $cmd , $out ) )
{
if($new_todos = file_get_contents( "saestor://todo/ttd-easy-". md5($out[1]) .".json" ))
$ret['js'] = "this.props.store.todo_load_base64('". base64_encode( $new_todos ) ."')";
else
$ret['js'] = "alert('Todo list [" . $out . "] not found 🙃 ')";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment