私のサイトに投稿されたリンクをハイパーリンクする次のスクリプトがあります。
$text = trim($text);
while ($text != stripslashes($text)) { $text = stripslashes($text); }
$text = strip_tags($text,"<b><i><u>");
$text = preg_replace("/(?<!http:\/\/)www\./","http://www.",$text);
$text = preg_replace( "/((http|ftp)+(s)?:\/\/[^<>\s]+)/i", "<a href=\"\\0\" target=\"_new\">\\0</a>",$text);
しかし、何らかの理由でhttps://www.test.com
リンクを追加すると、次のように表示されてしまいます - https://http://www.test.com
- 何が間違っているのでしょうか? https リンクでも機能させるにはどうすればよいですか? http リンクで正常に動作します。ありがとうございました!:-)