error_reporting (0);
echo "\ n". " Enter the dictionary you want to organize: "." \ n ";
$dic =trim (fgets (STDIN));
/***************************************
* Dictionary Optimizer tool Lostwolf
* Remove the dictionary and repeat the slash before each piece of data and remove the extra slash
*
* *************************************/
$file =file ($dic);
$array =preg_replace ('/($\s*$) | ( ^\s*^)/M ', ', $file); Eliminate blank Lines
foreach ($arrayas $key=> $r) {
$array [$key]=trim ("/$r"); Add slashes and remove whitespace characters
}
$new _array=preg_replace (' #^ ([/]*) # ', '/', $array); Replace the first multiple slashes with a
$new _array1=array_values (Array_unique ($new _array);//Eliminate duplicate rows
if (file_put_contents (' New_file.txt ', join ("\ r \ n", $new _array1))) {
echo "------------------------------------------". " \ r \ n ";
echo "\ n". " Finishing up! "." \ r \ n ";
echo "Generated dictionary file for:". " \ r \ n ";
Echodirname (__file__). Directory_separator. " New_file.txt "." \ r \ n ";
echo "------------------------------------------". " \ r \ n ";
}
else{
echo "------------------------------------------". " \ r \ n ";
echo "Error!". " \ r \ n ";
echo "Can't find the file!" Please check if the dictionary exists! "." \ r \ n ";
echo "------------------------------------------". " \ r \ n ";
}
?>
http://www.bkjia.com/PHPjc/478532.html www.bkjia.com true http://www.bkjia.com/PHPjc/478532.html techarticle ? PHP error_reporting (0); echo\n. Enter the dictionary to be collated:. \ n; $dic =trim (Fgets (STDIN));/************************************** * * Dictionary Optimizer tool Lostwolf * Remove dictionary repetition in each ...