view interface/load_regex.php @ 3:f196939ccc03

error handle and alert feedback to user. If error occurs, user'll not be halted by the loading page and sections_revisions will recovery to previous version.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 26 Jan 2015 12:19:39 +0100
parents b12c99b7c3f0
children 63e08b98032f
line wrap: on
line source

<?php

$returnArray = array();
$files1 = scandir("regex_files");
foreach ( $files1 as $file ) {
	if ( $file != "." && $file != ".." ) {
		$returnArray[preg_replace("/\.txt/", "", $file)] = file_get_contents( "regex_files/".$file );
	}
}

echo json_encode($returnArray);
?>