3

我尝试了 Zend 框架中var_dump的一个Zend_Controller_Request_Http对象。

输出如下:

object(Zend_Controller_Request_Http)[14]
  protected '_paramSources' => 
    array (size=2)
      0 => string '_GET' (length=4)
      1 => string '_POST' (length=5)
  protected '_requestUri' => string '/' (length=1)
  protected '_baseUrl' => string '' (length=0)
  protected '_basePath' => null
  protected '_pathInfo' => string '/' (length=1)
  protected '_params' => 
    array (size=3)
      'controller' => string 'index' (length=5)
      'action' => string 'index' (length=5)
      'module' => string 'default' (length=7)
  protected '_rawBody' => null
  protected '_aliases' => 
    array (size=0)
      empty
  protected '_dispatched' => boolean true
  protected '_module' => string 'default' (length=7)
  protected '_moduleKey' => string 'module' (length=6)
  protected '_controller' => string 'index' (length=5)
  protected '_controllerKey' => string 'controller' (length=10)
  protected '_action' => string 'index' (length=5)
  protected '_actionKey' => string 'action' (length=6)

我注意到在第一行,有一个[14],那个数字是什么意思?

我在 PHP 手册中查找了它,但没有找到任何解释。

4

1 回答 1

0

不,这不是“此对象中的属性数量”

我尝试了以下代码:

class testc
{
    protected $a;
    protected $b;
    private $c;
    private $d;
    public $e;
    public $f;
}

$a=new testc();
var_dump($a);

输出是:

object(testc)[1]
  protected 'a' => null
  protected 'b' => null
  private 'c' => null
  private 'd' => null
  public 'e' => null
  public 'f' => null
于 2013-09-07T05:52:53.217 回答