Created
June 25, 2017 02:35
-
-
Save easychen/6b2a60f0cee78e89859bfbd97ec6cc3c to your computer and use it in GitHub Desktop.
微贝增强脚本:Json导出
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
<?php | |
foreach( glob( '*.html' ) as $k => $htmlfile ) | |
{ | |
echo "File $htmlfile ..."; | |
$reg = '/this\.feeds\s+=\s+(.+?)\}\s+,\s+1000/is'; | |
$content = file_get_contents( $htmlfile ); | |
if( preg_match( $reg , $content , $out ) ) | |
{ | |
if($data = json_decode( trim($out[1]) , 1 )) | |
{ | |
@mkdir( 'json/', 0777 , true ); | |
$jsonfile = 'json/' . basename( $htmlfile ) . '.json'; | |
file_put_contents( $jsonfile , trim($out[1]) ); | |
echo "done.\r\n"; | |
} | |
else | |
echo "error.\r\n"; | |
} | |
} | |
echo "ALL Done."; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment