Home Backend Development PHP Tutorial PHP,ASP.JAVA,JAVA代码格式化工具整理_php技巧

PHP,ASP.JAVA,JAVA代码格式化工具整理_php技巧

May 17, 2016 am 09:24 AM
code format

PHP代码格式化工具http://www.waterproof.fr/products/phpCodeBeautifier/
最近修改一个代码,里面完全没有缩进,用这个能够格式化一下。
相当于以前c 的indent
顺便写一下其他语言的
c, c++ c# ==> indent Astyle
java ==> astyle Jalopy Jacobe ImportScrbber
php ==> phpCodeBeautifier
perl ==> perlTidy
python ==> Pydent
asp ==> VBSBeaut

工具名称 适用语言 简介 安装/使用
indent c indent就是代码美化工具的代名词 indent是gcc附带的一个标准工具,
indent [options] [input-files]
indent [options] [single-input-file] [-o output-file]
perltidy perl perltidy本身也是用perl写的 下载后: perl Makefile.PL;make;make install
perltidy [ options ] file1 file2 file3 ...
(output goes to file1.tdy, file2.tdy, file3.tdy, ...)
perltidy [ options ] file1 -o outfile
perltidy [ options ] file1 -st >outfile
perltidy [ options ] outfile
astyle c c++ java (php) 一个速度很快的C/C++/Java源代码美化工具。
astyle比indent好在有很多成套的的风格定义:ansi java linux...不必记住复杂的缩进具体选项。
下载源代码解包后,make, 生成astyle可执行文件
astyle [options] Beautified
astyle [options] Foo.cpp Bar.cpp [...]
astyle --style=ansi *.cpp
我尝试过用它来格式化PHP程序也很有效(当然是不合HTML代码混在一起的纯PHP代码)。
jalopy java 功能强大的JAVA代码格式化工具,除了标准界面外,命令行工具,还可作为ANT JBUILDER ECLIPSE JDEVELOPER等工具的插件使用,并提供API http://prdownloads.sourceforge.net/jalopy/下载
并参考相应安装文档
pydent python pythius包含了2个工具:
pydent: 代码缩进工具
pystat: 代码统计工具
下载源代码解包后:
Run "python setup.py build"
Run "python setup.py install"
htmltidy html/xml HTML代码的纠错工具,可以帮助你的HTML代码更好的符合W3C规范,现在被称作tidy,因为它不仅只使用于HTML,也现在也适用于XHTML XML的格式化。

但JSP不适合ASP PHP JSP等嵌入式脚本的代码美化

 

下载源代码后 make 生成tidy可执行文件:
tidy file1 file2 ...
注意:对于含有中文的页面要使用 -raw选项
tidy.exe -raw -imuq -wrap 132 -f %f.err %f
选项说明:
-raw: 不修改中文字符 (output values above 127 without conversion to entities)
-i indend 缺省HTML按2个空格缩进
-m 覆盖原文件
-u 强制所有HTML标记大写(这个可以不加)
-wrap 页面代码宽度大于132行强制换行
-f %f.err 将错误输出到"相应文件名.err"文件中
HTMLTIDY支持XML的格式美化:
tidy -xml -imq web.xml
tidy -xml -imq build.xml
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to format c drive with dos command How to format c drive with dos command Feb 19, 2024 pm 04:23 PM

DOS command is a command line tool used in Windows operating system, which can be used to perform various system management tasks and operations. One of the common tasks is to format the hard drive, including the C drive. Formatting the C drive is a relatively dangerous operation because it will erase all data on the C drive and reinitialize the file system. Before performing this operation, make sure you have backed up important files and have a clear understanding of the impact that formatting will have on your computer. The following is formatted in the DOS command line

What to do if the blue screen code 0x0000001 occurs What to do if the blue screen code 0x0000001 occurs Feb 23, 2024 am 08:09 AM

What to do with blue screen code 0x0000001? The blue screen error is a warning mechanism when there is a problem with the computer system or hardware. Code 0x0000001 usually indicates a hardware or driver failure. When users suddenly encounter a blue screen error while using their computer, they may feel panicked and at a loss. Fortunately, most blue screen errors can be troubleshooted and dealt with with a few simple steps. This article will introduce readers to some methods to solve the blue screen error code 0x0000001. First, when encountering a blue screen error, we can try to restart

GE universal remote codes program on any device GE universal remote codes program on any device Mar 02, 2024 pm 01:58 PM

If you need to program any device remotely, this article will help you. We will share the top GE universal remote codes for programming any device. What is a GE remote control? GEUniversalRemote is a remote control that can be used to control multiple devices such as smart TVs, LG, Vizio, Sony, Blu-ray, DVD, DVR, Roku, AppleTV, streaming media players and more. GEUniversal remote controls come in various models with different features and functions. GEUniversalRemote can control up to four devices. Top Universal Remote Codes to Program on Any Device GE remotes come with a set of codes that allow them to work with different devices. you may

Resolve code 0xc000007b error Resolve code 0xc000007b error Feb 18, 2024 pm 07:34 PM

Termination Code 0xc000007b While using your computer, you sometimes encounter various problems and error codes. Among them, the termination code is the most disturbing, especially the termination code 0xc000007b. This code indicates that an application cannot start properly, causing inconvenience to the user. First, let’s understand the meaning of termination code 0xc000007b. This code is a Windows operating system error code that usually occurs when a 32-bit application tries to run on a 64-bit operating system. It means it should

What does the blue screen code 0x000000d1 represent? What does the blue screen code 0x000000d1 represent? Feb 18, 2024 pm 01:35 PM

What does the 0x000000d1 blue screen code mean? In recent years, with the popularization of computers and the rapid development of the Internet, the stability and security issues of the operating system have become increasingly prominent. A common problem is blue screen errors, code 0x000000d1 is one of them. A blue screen error, or "Blue Screen of Death," is a condition that occurs when a computer experiences a severe system failure. When the system cannot recover from the error, the Windows operating system displays a blue screen with the error code on the screen. These error codes

Computer formatting tutorial Computer formatting tutorial Jan 08, 2024 am 08:21 AM

Many times when using a computer, you will encounter too much garbage, but many users still don’t know how to format the computer. It doesn’t matter. Here is a tutorial on computer formatting for you to take a look at. How to format a computer: 1. Right-click "This PC" on the desktop and click "Manage". 2. Click "Storage" in "Computer Management" to open "Disk Management". 3. Select the hard drive you want to clean, right-click and select "Format". 4. Check "Perform Quick Format" and click "OK" to start formatting.

Revealed secrets of cell phone format recovery methods (mobile phone malfunction? Don't worry) Revealed secrets of cell phone format recovery methods (mobile phone malfunction? Don't worry) May 04, 2024 pm 06:01 PM

Nowadays, we will inevitably encounter some problems such as being unable to turn on the phone or lagging, such as system crash, but during use, mobile phones have become an indispensable part of our lives. We are often at a loss, and sometimes, there are no solutions to these problems. To help you solve cell phone problems, this article will introduce you to some methods of cell phone format recovery and restore your phone to normal operation. Back up data - protect important information, such as photos and contacts, from being lost during the formatting process. Before formatting your phone, the first thing to consider is to back up important data and files on your phone. To ensure data security, or choose to transfer files to a cloud storage service, you can back it up by connecting to a computer. Use the system's built-in recovery function - simple

Will formatting a laptop make it faster? Will formatting a laptop make it faster? Feb 12, 2024 pm 11:54 PM

Will formatting a laptop make it faster? If you want to format your Windows laptop but want to know if it will make it faster, this article will help you know the right answer to this question. Will formatting a laptop make it faster? There are many reasons why users format their Windows laptops. But the most common reason is slow performance or speed of your laptop. Formatting a laptop will completely delete all data stored on the C drive or the hard drive partition where Windows operating system is installed. Therefore, every user will think twice before taking this step, especially when it comes to the performance of the laptop. This article will help you understand whether formatting your laptop will speed it up. Formatting your laptop helps

See all articles