Created
August 1, 2019 14:46
-
-
Save deepslam/424c56dfb43ccbb62dbc9e10dccddf6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
if (!function_exists('ssr')) { | |
function ssr(string $ident = '', $element): string { | |
$path = storage_path('prerendered/'.$ident.'.json'); | |
if (file_exists($path)) { | |
$content = file_get_contents($path); | |
$json = json_decode($content); | |
if ($json && isset($json->$element)) { | |
return $json->$element; | |
} | |
} | |
return ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment