简体   繁体   English

Zend Studio如何像NetBeans 7.1一样格式化PHP代码?

[英]How to have Zend Studio format PHP code like NetBeans 7.1 does?

I work with NetBeans 7.1, I like how NetBeans formats the PHP code. 我使用NetBeans 7.1,我喜欢NetBeans格式化PHP代码的方式。

I'm working on this project with other developer, but he uses Zend Studio (ZS), and when he reformats the code with ZS, and commit the changes to git, it appears like he has changed the whole file, when in fact it was just change a few lines. 我正在与其他开发人员一起进行此项目,但是他使用Zend Studio(ZS),并且当他使用ZS重新格式化代码并将更改提交到git时,似乎他已经更改了整个文件,实际上只是改变了几行而已。 This beats the whole purpose of having the version control, if every little change in the code will look like the whole file was changed. 如果代码中的每一个小改动看起来都像整个文件都被更改了,那么这超出了拥有版本控制的目的。

He likes Zend Studio, I don't want to impose him using other product. 他喜欢Zend Studio,我不想强​​加他使用其他产品。 I won't mind use ZS, but can't pay the $300 price tag, when I have what I need with NetBeans for free. 当我免费使用NetBeans时,我不介意使用ZS,但不能支付$ 300的价格。

So I'm looking for a way to have him continue using his IDE, but when he formats his code, ZS does it the same same way as NetBeans does. 因此,我正在寻找一种让他继续使用他的IDE的方法,但是当他格式化自己的代码时,ZS的方式与NetBeans相同。

Any suggestions on what to change on Zend Studio to have the code formatting like NetBeans 7.1 does? 关于在Zend Studio上进行哪些更改以使代码格式像NetBeans 7.1一样,有何建议?

Thanks! 谢谢!

Try installing the PHPCS plugin in NetBeans and select the ZEND framework ruleset for setting up the coding standards, this will auto format the code in NetBeans as it is done in ZS. 尝试在NetBeans中安装PHPCS插件,然后选择ZEND框架规则集以设置编码标准,这将像在ZS中一样自动格式化NetBeans中的代码。 You may google or also take a look at some of these articles: 您可以在Google上搜索,也可以查看以下一些文章:

In short, you both need to decide and follow some coding standards. 简而言之,你们俩都需要决定并遵循一些编码标准。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM