We are using
Recently need to tidy up a whole station PHP code specification view, the previous days found PHPCB tidy view is very good, but there is a drawback is not batch processing, using the process found PHPCB is a CMD program, immediately think of PHP system function call cmd, think about doing, The following is a PHPCB batch conversion PHP Program:
- < ?
- header ("content-type:text/html; CharSet = gb2312 ");
- Define (' Root_path ', DirName (__file__));
- $ Topath = "WW" / //To format the view directory name, do not front and back "/"
- $ Path = Root_path ." /". $topath;
- $ arr = Get_all_files ($path);
- For ($i=0; $i<count($arr); $i + +)
- {
- $ Phpext = Fileext ($arr [$i]);
- if ($phpext= = "php")
- {
- $ cmd = "PhpCB.exe" . $arr [$i]. " > ". $arr [$i].". PHPCB ";
- System ($CMD);
- Unlink ($arr [$i]);
- @rename ($arr [$i]. ". PHPCB ", $arr [$i]);
- }
- }
- function Get_all_files ($path) {
- $ List = Array ();
- foreach (Glob ($path. '/* ') as $item) {
- if (Is_dir ($item)) {
- $ List = Array_merge ($list, Get_all_files ($item));
- } else {
- $list [] = $item;
- }
- }
- return $list;
- }
- function Fileext ($filename) {
- Return Trim (substr (STRRCHR ($filename, '. '), 1, 10));
- }
- ?>
PHPCB the use of batch conversion: Put PhpCB.exe in the windows/system32/Directory, PHP execution program and the folder to be converted to the same level of path, first configure the $topath, and then access the program in the browser, no results output.
http://www.bkjia.com/PHPjc/446130.html www.bkjia.com true http://www.bkjia.com/PHPjc/446130.html techarticle we are using the recent need to tidy up a full site of the PHP Code specification view, a few days ago found PHPCB tidy view is very good, but there is a drawback is not batch processing, using the process found PHP ...