php - PHP中var_dump输出后的方括号

标签 php var-dump

我尝试var_dump Zend 框架中的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 手册中查找它,但没有找到任何解释。

最佳答案

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

我试过下面的代码:

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

关于php - PHP中var_dump输出后的方括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18670091/

相关文章:

php - 是否有独立的 PHP 路由库?

php - 在 Laravel 5.2 中将数据插入数据透视表

php - 当我使用 var_dump 变量调试 php 时,它总是在开头输出文件路径?

php - var_dump 或 print_r 和 html 编码

php - 彩色 var_dump() 和错误

php - SQL 查询在 phpMyAdmin 中正常,但在 PHP 代码中不起作用

php - 如何在 Linux/Apache 虚拟主机上运行 win32 控制台应用程序?

php - 收集 subreddit 标题(批量)的最佳方式是什么

php - 检测 simpleXml 数组属性

php - 使用 FirePHP 而不是 var_dump