Last active
March 9, 2018 12:34
-
-
Save billyct/e4fb3aa3a9045fdbe93f64986b3477a4 to your computer and use it in GitHub Desktop.
unescape unicode files under path
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 | |
function unescapedFiles($path){ | |
$files = array_diff(scandir($path), array('.', '..')); | |
foreach ($files as $file) { | |
$file = str_finish($path, '/') . $file; | |
$content = json_decode(file_get_contents($file), true); | |
$content = json_encode($content, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); | |
file_put_contents($file, $content); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment