简体   繁体   English

标准功能的NetBeans PHP代码完成

[英]NetBeans PHP Code Completion for Standard Functions

I have started to use NetBeans 6.9.1 for developing PHP projects. 我已经开始使用NetBeans 6.9.1开发PHP项目。 Although it does provide code completion to certain extent, but it's by no means complete. 尽管它确实提供了一定程度的代码完成,但是它绝不是完整的。 For example, commonly used functions such as implode,explode are not in the list for code completion. 例如,常用功能(例如implode,explode)不在代码完成列表中。 Also, it would have been convenient to have code completion for objects made from built in classes, such as HttpRequest. 同样,对由内置类(例如HttpRequest)制成的对象进行代码完成会很方便。

Is there anyway to obtain code completion for the items mentioned above. 无论如何,是否需要获取上述项目的代码完成。

Try this... 尝试这个...

  • Tools->Options 工具 - >选项
  • Selct "Editor" 选择“编辑器”
  • Select "Code completion" 选择“代码完成”
  • In language drop down select "PHP" 在语言下拉列表中选择“ PHP”

You will see a list of code completion options for PHP project ONLY 您将仅看到PHP项目的代码完成选项列表

  • If you have global variables/objects set "Code Completion for Variables" is set to "All Variables" 如果设置了全局变量/对象,则将“变量的代码完成”设置为“所有变量”
  • If you are using methods without static in front of them as static make sure under "Code Completing for Class Methods" you have "Also Non-Static Methods after ::" 如果使用前面没有静态的方法作为静态方法,请确保在“类方法的代码完成”下您有“ ::之后还有非静态方法”。

If you are not using namespaces PHP 5.3, make sure you project is type is test to PHP 5.2/5.1. 如果未使用PHP 5.3命名空间,请确保您的项目的类型已通过PHP 5.2 / 5.1的测试。 To check it, right click your project->Properties->Sources->PHP Version. 要对其进行检查,请右键单击您的项目->属性->源-> PHP版本。

I checked the above thread and my project settings are correct, as are the PHP settings and plugins are enabled. 我检查了上述线程,我的项目设置正确,同时启用了PHP设置和插件。 Each PHP editor window shows and editable form, but there is no hints,completion or anything else that is helpful whilst writing code. 每个PHP编辑器窗口都显示和可编辑形式,但是在编写代码时没有提示,完成或任何其他有用的信息。 I figured it out in the end: each PHP section started and ended as below: 我最终弄清楚了:每个PHP部分的开始和结束如下:

<?   ?>

should have been: 本来应该:

<?php    ?>

tags are deprecated (since php 7.0+), but you can enable it in NetBeans if You're working with legacy code at: 标记已弃用(自php 7.0+起),但是如果您要在以下位置使用旧代码,则可以在NetBeans中启用它:

Project Properties -> Sources mark Option: Allow short tags, it is also possible to allows ASP tags <% %> there. 项目属性->源标记选项:允许短标签,也可以在那里允许ASP标签<%%>。

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

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