[Php 5, Php 7, Php 8]
SimpleXML_LOAD_STRING - Giải thích chuỗi XML thành một đối tượng — Interprets a string of XML into an object
Sự mô tả
SimpleXML_Load_String [& nbsp; & nbsp; & nbsp; & nbsp; chuỗi ________ 1, & nbsp; & nbsp; & nbsp; ; chuỗi $namespace_or_prefix
= "", & nbsp; & nbsp; & nbsp; & nbsp;[
string $data
,
?string
$class_name
= SimpleXMLElement::class,
int $options
= 0,
string $namespace_or_prefix
= "",
bool $is_prefix
= false
]:
SimpleXMLElement|false
Thông số
data
Chuỗi XML được hình thành tốt
________số 8Bạn có thể sử dụng tham số tùy chọn này để SimplexML_Load_String [] sẽ trả về một đối tượng của lớp được chỉ định. Lớp đó sẽ mở rộng lớp simplexmlelement.simplexml_load_string[] will return an object of the specified class. That class should extend the SimpleXMLElement class.
options
Vì libxml 2.6.0, bạn cũng có thể sử dụng tham số options
để chỉ định các tham số LibXML bổ sung.
$data
1Tiền tố không gian tên hoặc URI.
$data
2 $data
3 nếu $data
1 là tiền tố, false
nếu đó là URI; Mặc định là false
. if $data
1 is a
prefix, false
if it's a URI; defaults to false
.
Trả về giá trị
Trả về một đối tượng của lớp simplexmlelement với các thuộc tính chứa dữ liệu được giữ trong tài liệu XML hoặc false
về lỗi.object of class SimpleXMLElement with properties containing the data held within the xml document, or false
on failure.
Cảnh báo
Hàm này có thể trả về Boolean false
, nhưng cũng có thể trả về giá trị phi Boolean đánh giá thành false
. Vui lòng đọc phần về Booleans để biết thêm thông tin. Sử dụng toán tử === để kiểm tra giá trị trả về của hàm này.false
, but may also return a non-Boolean value which evaluates to false
. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.
Errors/Exceptions
Tạo thông báo lỗi $class_name
0 cho mỗi lỗi được tìm thấy trong dữ liệu XML.$class_name
0 error message for each error found in the XML data.
Ví dụ
Ví dụ #1 Giải thích Chuỗi XML
$class_name
1
Ví dụ trên sẽ xuất ra:
SimpleXMLElement Object [ [title] => Forty What? [from] => Joe [to] => Jane [body] => I know that's the answer -- but what's the question? ]
Tại thời điểm này, bạn có thể sử dụng $class_name
2 và như vậy.
Xem thêm
- simplexml_load_file [] - diễn giải tệp xml thành một đối tượng
- SimplexMlEuity :: __ confruct [] - Tạo một đối tượng SimplexMlelement mới
- Xử lý các lỗi XML
- libxml_use_iNternal_errors [] - Tắt lỗi libxml và cho phép người dùng tìm nạp thông tin lỗi khi cần
- Sử dụng đơn giản cơ bản
ascammon tại hotmail dot com ¶
11 năm trước
$class_name
3
$class_name
4
$class_name
5
$class_name
6Diego Araos, Diego tại Klapmedia Dot Com ¶ ¶
11 năm trước
$class_name
7
$class_name
8
$class_name
6Diego Araos, Diego tại Klapmedia Dot Com ¶ ¶
Rowan Dot Collins tại Gmail Dot Com ¶
$options
0
$options
1
$options
2
$options
3
$options
4
$options
5
$options
614 năm trước ¶
Rowan Dot Collins tại Gmail Dot Com ¶
$options
7
$options
8
$options
9
$namespace_or_prefix
014 năm trước ¶
Bojan ¶
$namespace_or_prefix
1
$namespace_or_prefix
2
$namespace_or_prefix
3
$namespace_or_prefix
4Meustrus ¶ ¶
7 năm trước
$namespace_or_prefix
5
$namespace_or_prefix
6
$namespace_or_prefix
7
$namespace_or_prefix
8sức mạnh ý chí ¶ ¶
7 năm trước
$namespace_or_prefix
9
$is_prefix
0
$is_prefix
1
$class_name
6sức mạnh ý chí ¶ ¶
Rowan Dot Collins tại Gmail Dot Com ¶
$is_prefix
3
$is_prefix
4
$is_prefix
5
$is_prefix
614 năm trước ¶
7 năm trước
$is_prefix
7
$is_prefix
8
$class_name
6sức mạnh ý chí ¶ ¶
Rowan Dot Collins tại Gmail Dot Com ¶
false
0
false
1
false
2
false
3
false
414 năm trước ¶
Bojan ¶
false
5
false
6
false
7
$class_name
6Meustrus ¶ ¶
7 năm trước
false
9
data
0
$class_name
6sức mạnh ý chí ¶ ¶
Bojan ¶
data
2
data
3
$class_name
6Meustrus ¶ ¶
7 năm trước
data
5
sức mạnh ý chí ¶ ¶
7 năm trước
data
6
sức mạnh ý chí ¶ ¶
7 năm trước
data
7
data
8
data
9
$class_name
6sức mạnh ý chí ¶ ¶
15 năm trước
class_name
1
class_name
2
class_name
3
$class_name
6nbijnens tại servs dot eu ¶ ¶
amir_abiri tại ipcmedia dot com ¶
class_name
5
class_name
6
class_name
7
class_name
8
$class_name
6Hattori tại Hanso Dot Com ¶ ¶
javalc6 tại gmail dot com
options
0
options
1
options
2
options
3