如何从 NetBeans 中的 PHP 类模板中删除模板更改消息?
在 NetBeans 中,当我使用 PHP 类模板添加新文件时,新类包含以下注释:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
然而,当我按照说明编辑模板时,此文本不会出现在模板中的任何位置。我怎样才能避免在我的所有新课程中包含此评论?
In NetBeans, when I add a new file using the PHP Class template, the new class contains the following comment:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
Yet this text doesn't appear anywhere in the template when I follow it's instructions to edit the template. How can I avoid having this comment included in all my new classes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您需要从 PHP 类模板顶部删除
<#include "../Licenses/license-${project.license}.txt">
。不要忘记对界面、文件和网页执行此操作。您尝试删除的文本是默认许可证的一部分,因此您只需更改/删除其中的文本即可。默认许可证位于模板管理器的许可证文件夹下。
或者,您可以在
~/.netbeans/7.0/config/Templates/Licenses/
中放置一个空白文本文件或许可证文件,并将该文件命名为license-foo.txt
,然后在您的project.properties 文件中定义一个键project.license
并将其设置为foo
。如果您这样做,您将需要为每个项目定义相同的键,否则您将再次获得不需要的文本。编辑:
实际上,要添加许可证,您只需在选择许可证文件夹后单击模板管理器内的添加...按钮即可。
You need to remove
<#include "../Licenses/license-${project.license}.txt">
from the top of the PHP class template. Don't forget to do this for Interface, File, and Web Page.The text that you are trying to get rid of is part of the Default License so you could just change/remove the text there. The Default License is under the Licenses folder in the Template Manager.
Alternatively you could put a blank text file or license file in
~/.netbeans/7.0/config/Templates/Licenses/
and name the filelicense-foo.txt
and then in your project.properties file define a keyproject.license
and set it tofoo
. If you did this you would need to define the same key for each project or you would get the unwanted text again.Edit:
Actually to add a license you can just click the Add... button inside the Template Manager after selecting the Licenses folder.