array(1) {   ["index""/>   array(1) {   ["index"">
Home > Backend Development > PHP Tutorial > 用var_dump输出一个对象,带@的属性代表什么?该怎么处理

用var_dump输出一个对象,带@的属性代表什么?该怎么处理

WBOY
Release: 2016-06-13 13:06:22
Original
1065 people have browsed it

用var_dump输出一个对象,带@的属性代表什么?
如var_dump输出一个SimpleXMLElement对象,显示如下

object(SimpleXMLElement)#4 (3) {
  ["@attributes"]=>
  array(1) {
  ["index"]=>
  string(1) "1"
  }
  ["name"]=>
  string(7) "书本1"
  ["story"]=>
  array(3) {
  [0]=>
  object(SimpleXMLElement)#5 (2) {
  ["title"]=>
  string(14) "书本1故事1"
  ["quote"]=>
  string(20) "书本1故事1内容"
  }
  [1]=>
  object(SimpleXMLElement)#6 (2) {
  ["title"]=>
  string(14) "书本1故事2"
  ["quote"]=>
  string(20) "书本1故事2内容"
  }
  }
}

那个还@的["@attributes"]代表什么意思,请举一个类似的class,谢谢

------解决方案--------------------
是你用 SimpleXMLElement 说事,而不是我

PHP code
$a = array( '@abc' => 2);
settype($a, 'object');
echo $a->{'@abc'}; <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template