【问题标题】:Issue with the output objects输出对象的问题
【发布时间】:2013-08-17 05:08:06
【问题描述】:

在一个脚本中,我使用var_dump() 输出对象:

foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extKey.'/'.$this->scriptRelPath] as $classRef) {
                $hookObj = t3lib_div::getUserObj($classRef);
                var_dump($hookObj);

结果是:

object(tx_job_dagoupost)#73 (3) { ["extKey"]=> string(3) "job" ["prefixId"]=> string(10) "tx_job_pi1" ["scriptRelPath"]=> string(32) "hooks/class.tx_job_dagoupost.php" } 
object(tx_christianvolunteer_dagoupost)#79 (2) { ["extKey"]=> string(19) "christian_volunteer" ["scriptRelPath"]=> string(47) "hooks/class.tx_christianvolunteer_dagoupost.php" } 
object(tx_watermark_dagoupost)#73 (2) { ["extKey"]=> string(9) "watermark" ["scriptRelPath"]=> string(38) "hooks/class.tx_watermark_dagoupost.php" }

问题:

  1. #73#79 是什么意思?

  2. object(tx_job_dagoupost)#73object(tx_watermark_dagoupost)#73 是不同的对象,但它们的 id 相同 #73,为什么?

【问题讨论】:

标签: php


【解决方案1】:
  1. 正如所解释的,here 符号 # 是 PHP 对象的内部标识符。
  2. 不同对象的相同标识符意味着您的第一个对象 (tx_job_dagoupost) 是瞬态的(未分配给任何变量或未设置变量)并且 PHP 对下一个对象使用相同的标识符。

【讨论】:

    猜你喜欢
    • 2017-03-12
    • 1970-01-01
    • 2020-04-11
    • 1970-01-01
    • 2018-02-06
    • 1970-01-01
    • 2012-01-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多