PHPCB--PHP美化工具
下载地址: http://www.waterproof.fr/products/phpCodeBeautifier/
PHP代码美化工具:phpCodeBeautifier。它能够优化PHP代码,让你很糟糕的PHP代码变的很整齐。
editplus配置技巧
参数
--space-after-if --optimize-eol --space-after-switch --space-after-while --space-before-start-angle-bracket --space-after-end-angle-bracket --extra-padding-for-case-statement --glue-amperscore --change-shell-comment-to-double-slashes-comment --indent-with-tab --force-large-php-co
起始目录
$(FileDir)
PHPCB批量转换
方法: 把phpCB.exe放在windows/system32/目录下,php执行程序和要转换的文件夹放同一级路径,先配置$topath,然后在浏览器里访问本程序,没有结果输出。
代码如下:
- < ?
- header("Content-type: text/html; charset=gb2312");
- define('ROOT_PATH', dirname(__FILE__));
- $topath="ww"; //要格式化视图的目录名,前后都不要“/”
- $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));
- }
- ?>
-------------我的签名档---------------------
年轻人,还需要多努力!
--------------------------------------------