Hướng dẫn what is simplexml_ load_ string in php? - chuỗi tải simplexml trong php là gì?

(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ố 8

Bạ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.

$data1

Tiền tố không gian tên hoặc URI.

$data2

$data3 nếu $data1 là tiền tố, false nếu đó là URI; Mặc định là false. if $data1 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_name0 cho mỗi lỗi được tìm thấy trong dữ liệu XML.$class_name0 error message for each error found in the XML data.

Ví dụ

Ví dụ #1 Giải thích Chuỗi XML

$class_name1

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_name2 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_name3

$class_name4

$class_name5

$class_name6

Diego Araos, Diego tại Klapmedia Dot Com ¶

11 năm trước

$class_name7

$class_name8

$class_name6

Diego Araos, Diego tại Klapmedia Dot Com ¶

Rowan Dot Collins tại Gmail Dot Com ¶

$options0

$options1

$options2

$options3

$options4

$options5

$options6

14 năm trước

Rowan Dot Collins tại Gmail Dot Com ¶

$options7

$options8

$options9

$namespace_or_prefix0

14 năm trước

Bojan ¶

$namespace_or_prefix1

$namespace_or_prefix2

$namespace_or_prefix3

$namespace_or_prefix4

Meustrus ¶

7 năm trước

$namespace_or_prefix5

$namespace_or_prefix6

$namespace_or_prefix7

$namespace_or_prefix8

sức mạnh ý chí ¶

7 năm trước

$namespace_or_prefix9

$is_prefix0

$is_prefix1

$class_name6

sức mạnh ý chí ¶

Rowan Dot Collins tại Gmail Dot Com ¶

$is_prefix3

$is_prefix4

$is_prefix5

$is_prefix6

14 năm trước

7 năm trước

$is_prefix7

$is_prefix8

$class_name6

sức mạnh ý chí ¶

Rowan Dot Collins tại Gmail Dot Com ¶

false0

false1

false2

false3

false4

14 năm trước

Bojan ¶

false5

false6

false7

$class_name6

Meustrus ¶

7 năm trước

false9

data0

$class_name6

sức mạnh ý chí ¶

Bojan ¶

data2

data3

$class_name6

Meustrus ¶

7 năm trước

data5

sức mạnh ý chí ¶

7 năm trước

data6

sức mạnh ý chí ¶

7 năm trước

data7

data8

data9

$class_name6

sức mạnh ý chí ¶

15 năm trước

class_name1

class_name2

class_name3

$class_name6

nbijnens tại servs dot eu ¶

amir_abiri tại ipcmedia dot com ¶

class_name5

class_name6

class_name7

class_name8

$class_name6

Hattori tại Hanso Dot Com ¶

javalc6 tại gmail dot com

options0

options1

options2

options3