PHP是什么意思啊?

时间:2012-06-07 16:24:09

标签: php magento

  

可能重复:
  Reference - What does this symbol mean in PHP?

我在PHP magento'Mage :: run()'中使用了这个符号。

什么意思?似乎无法在任何地方找到简单的解释。

4 个答案:

答案 0 :(得分:1)

这是Scope Resolution Operator(也称为Paamayim Nekudotayim)。它允许您访问常量或静态方法。

答案 1 :(得分:1)

它允许您在类中调用静态函数/方法,而无需创建类的实例:

class myClass{

static function myFunction(){
echo"foo";
}
}

现在使用::

调用它
myClass::myFunction;

使用公共函数,您必须创建一个实例:

$mycalssinstance= new myCalss;
//then call it
$mycalssfunction=$mycalssinstance->myFunction();

答案 2 :(得分:0)

调用静态(类)方法。你可以在没有该类实例的情况下调用它。

http://us.php.net/manual/en/language.oop5.paamayim-nekudotayim.php

答案 3 :(得分:0)

它是对静态php函数的引用

http://php.net/manual/en/language.oop5.static.php