[Php 5, Php 7, Php 8]
SimpleXMlelement :: Thuộc tính - Xác định các thuộc tính của một phần tử — Identifies an element's attributes
Sự mô tả
publicsimplexmlelement :: thuộc tính [? chuỗi $namespaceOrPrefix
= null
, bool $isPrefix
= false
]:? SimplexMlelement SimpleXMLElement::attributes[?string $namespaceOrPrefix
= null
,
bool $isPrefix
= false
]: ?SimpleXMLElement
Lưu ý: SimplexML đã đưa ra một quy tắc thêm các thuộc tính lặp vào hầu hết các phương thức. Chúng không thể được xem bằng var_dump [] hoặc bất cứ thứ gì khác có thể kiểm tra các đối tượng.: SimpleXML has made a rule of adding iterative properties to most methods. They cannot be viewed using var_dump[] or anything else which can examine objects.
Thông số
namespaceOrPrefix
Một không gian tên tùy chọn cho các thuộc tính được truy xuất
isPrefix
Mặc định là false
false
Trả về giá trị
Trả về một đối tượng SimpLEXMLEuity có thể được lặp lại để lặp qua các thuộc tính trên thẻ.SimpleXMLElement object that can be iterated over to loop through the attributes on the tag.
Trả về null
nếu được gọi trên một đối tượng SimplexMlEuity đã đại diện cho một thuộc tính chứ không phải một thẻ.null
if called on a SimpleXMLElement object that already represents an attribute and not a tag.
Ví dụ
Ví dụ #1 Giải thích Chuỗi XML
Ví dụ trên sẽ xuất ra:
Xeoncross ¶ ¶
12 năm trước
It is really simple to access attributes using array form. However, you must convert them to strings or ints if you plan on passing the values to functions.
null
0
null
1
null
2Chris tại chlab dot ch ¶ ¶
10 năm trước
null
3
null
4
null
5
null
6
null
7sarlak ¶ ¶
11 năm trước
null
8
TotalWipeout tại Gmail Dot Com ¶ ¶
10 năm trước
null
9
$isPrefix
0
$isPrefix
1
$isPrefix
2sarlak ¶ ¶
11 năm trước
$isPrefix
3
$isPrefix
4
$isPrefix
5
$isPrefix
6
$isPrefix
7
$isPrefix
8
$isPrefix
9
false
0
false
1
false
2
false
3TotalWipeout tại Gmail Dot Com ¶ ¶
11 năm trước
false
4
false
5
false
6TotalWipeout tại Gmail Dot Com ¶ ¶
12 năm trước
false
7
false
8
false
9
namespaceOrPrefix
0
namespaceOrPrefix
1
false
6Chris tại chlab dot ch ¶ ¶
10 năm trước
namespaceOrPrefix
3
namespaceOrPrefix
4
namespaceOrPrefix
5
namespaceOrPrefix
6sarlak ¶ ¶
11 năm trước
namespaceOrPrefix
7
namespaceOrPrefix
8
namespaceOrPrefix
9
isPrefix
0
false
6TotalWipeout tại Gmail Dot Com ¶ ¶
webfelipemaia tại gmail dot com ¶
isPrefix
2
isPrefix
3
false
69 năm trước ¶
11 năm trước
isPrefix
5
isPrefix
6
isPrefix
7
isPrefix
8
false
6TotalWipeout tại Gmail Dot Com ¶ ¶
webfelipemaia tại gmail dot com ¶
false
0
false
1
false
6