回答編集履歴

1

コードサンプル追記。

2018/08/22 06:40

投稿

otn
otn

スコア84423

test CHANGED
@@ -11,3 +11,35 @@
11
11
  $abslink = dirname($url) ."/". $link;
12
12
 
13
13
  ```
14
+
15
+ #追記
16
+
17
+ 最初の方で、
18
+
19
+ ```PHP
20
+
21
+ $base = "目的ページのURLの最後のファイル名を除いた物";
22
+
23
+
24
+
25
+ 例えば、http://example.com/foo/bar/baz/hoge.html なら、
26
+
27
+ $base = "http://example.com/foo/bar/baz/";
28
+
29
+ ```
30
+
31
+ あとは、
32
+
33
+ ```PHP
34
+
35
+ // トピックスタイトル(ここにリンクが貼られる)
36
+
37
+ $out = $html->find('#stage #contents .main-contents tr .list table tr td',1);
38
+
39
+ echo str_replace('href="', 'href="'.$base, $out-> outertext);
40
+
41
+ echo '</div>';
42
+
43
+ ```
44
+
45
+ 以下同じ。