質問するログイン新規登録

回答編集履歴

1

追記しました

2016/07/04 01:28

投稿

yambejp
yambejp

スコア118102

answer CHANGED
@@ -19,4 +19,13 @@
19
19
  }
20
20
  print $content;
21
21
  ?>
22
- ```
22
+ ```
23
+ # 追記
24
+ preg_replace_callback()だとこんな感じ?
25
+
26
+ ```PHP
27
+ $pattern="|(http://exmple.com/a/b/c/)([a-zA-Z0-9&\?\=\+\/\*\-]*)|";
28
+ $replacement=function($a){return $a[1].urlencode($a[2]);};
29
+ $content=preg_replace_callback($pattern,$replacement,$content);
30
+
31
+ ```