用PHP创建类

Has*_*rab -1 php syntax class

我是PHP的新手,我不喜欢在类似记事本的编辑器中编写我的代码.有像VS for PHP的编辑器吗?

另外,如果你能给我一个好的介绍性PHP电子书(一个涵盖简单的概念,如声明和使用PHP中的类)的参考,那将是很棒的.

提前致谢!

Mic*_*l M 5

  1. 在寻找PHP IDE?
  2. 手册

这就是你真正需要的一切.


NDM*_*NDM 5

对于IDE,有很多选项。有VS.PHP(集成在VS中),eclipse PDT,Zend Studio(基于eclipse构建,但不是免费的)

在PHP中无法使用访问器声明类,因此声明了一个类:

class {}
//and not
public class {}
Run Code Online (Sandbox Code Playgroud)

如果文件中有一个类,并且想在另一个文件中使用它,则需要包含该文件

require_once('MyClass.php');
$myClass = new MyClass(); //note that PHP is not type safe so a variable does not have a type
Run Code Online (Sandbox Code Playgroud)