質問編集履歴

2

コードを追記しました。

2021/05/19 06:08

投稿

pegy
pegy

スコア245

test CHANGED
File without changes
test CHANGED
@@ -14,6 +14,10 @@
14
14
 
15
15
  //main.php
16
16
 
17
+ require_once("function.php");
18
+
19
+
20
+
17
21
  $data = '<div id="wrapper">
18
22
 
19
23
  <img src="data:sssss" onclick="ss">
@@ -27,6 +31,14 @@
27
31
  </p>
28
32
 
29
33
  </div>';
34
+
35
+
36
+
37
+ $dom = new DOMDocument();
38
+
39
+ $dom -> loadHTML($data);
40
+
41
+ $item = $dom->getElementById('wrapper')->childNodes;
30
42
 
31
43
  ```
32
44
 

1

エラーコードを追記しました

2021/05/19 06:08

投稿

pegy
pegy

スコア245

test CHANGED
File without changes
test CHANGED
@@ -11,6 +11,8 @@
11
11
 
12
12
 
13
13
  ```php
14
+
15
+ //main.php
14
16
 
15
17
  $data = '<div id="wrapper">
16
18
 
@@ -31,6 +33,8 @@
31
33
 
32
34
 
33
35
  ```php
36
+
37
+ //function.php
34
38
 
35
39
  //--------------------------------------------------------------------------------------------------------//
36
40
 
@@ -73,3 +77,17 @@
73
77
  //--------------------------------------------------------------------------------------------------------//
74
78
 
75
79
  ```
80
+
81
+
82
+
83
+ 追記
84
+
85
+ ```php
86
+
87
+ Warning: DOMDocument::loadHTML(): Unexpected end tag : span in Entity, line: 5 in /Applications/MAMP/htdocs/textile/dist/main.php on line 39
88
+
89
+
90
+
91
+ Notice: Undefined property: DOMText::$tagName in /Applications/MAMP/htdocs/textile/dist/function.php on line 24
92
+
93
+ ```