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-code-tag --force-true-false-null-contant-lowercase --comment-rendering-style PEAR --equal-align-position 50 --padding-char-count 1 "$(FilePath)" 

起始目录 
$(FileDir) 

 

PHPCB批量转换

方法: 把phpCB.exe放在windows/system32/目录下,php执行程序和要转换的文件夹放同一级路径,先配置$topath,然后在浏览器里访问本程序,没有结果输出。

代码如下:

  1. < ?  
  2. header("Content-type: text/html; charset=gb2312");  
  3. define('ROOT_PATH', dirname(__FILE__));  
  4. $topath="ww"; //要格式化视图的目录名,前后都不要“/”  
  5. $path=ROOT_PATH."/".$topath;  
  6. $arr=get_all_files($path);  
  7. for($i=0;$i<count($arr);$i++)  
  8. {  
  9. $phpext=fileext($arr[$i]);  
  10. if($phpext=="php")  
  11. {  
  12. $cmd="phpCB.exe ".$arr[$i]." > ".$arr[$i].".phpCB";  
  13. system($cmd);  
  14. unlink($arr[$i]);  
  15. @rename($arr[$i].".phpCB",$arr[$i]);  
  16. }  
  17. }  
  18. function get_all_files($path){  
  19. $list = array();  
  20. foreach(glob($path . '/*') as $item){  
  21. if(is_dir($item)){  
  22. $list = array_merge($list , get_all_files( $item ));  
  23. } else {  
  24. $list[] = $item;  
  25. }  
  26. }  
  27. return $list;  
  28. }  
  29. function fileext($filename) {  
  30. return trim(substr(strrchr($filename, '.'), 1, 10));  
  31. }  
  32. ?>  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值