Home  >  Article  >  Backend Development  >  PHP code encryption -- php_strip_whitespace function, removes all comments and spaces from the source code and displays it on one line

PHP code encryption -- php_strip_whitespace function, removes all comments and spaces from the source code and displays it on one line

WBOY
WBOYOriginal
2016-08-08 09:27:481117browse

//Open all directories of files
$dir = "./tp/Home/Lib/Action/" ;

if ( $handle = opendir ( $dir )) {

while ( false !== ( $file = readdir ( $handle ))) {

          if ( $file != "." && $file != ".." ) {

F echo $ file. '& Lt; br /& gt;'; 中 // Remove all comments and spaces in the file

$ newfile = php_strip_whitespace ($ dir. $ File);

file_put_contents ('./ TP/Home/NewAction/'. Basename ($ file), $ n ewfile);


}

}

closedir ( $handle );

}

?>

The above introduces the PHP code encryption - php_strip_whitespace function, which removes all comments and spaces from the source code and displays it on one line, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn