Re: [請益] http:// 自動轉成網址

看板PHP作者 (小惡魔)時間16年前 (2009/10/03 17:26), 編輯推噓6(602)
留言8則, 5人參與, 最新討論串2/2 (看更多)
※ 引述《hate5566 (黑特56)》之銘言: : 請問一下 在表單內的文字內容 : 若出現 http://xxx.xxx.xxx.xx : 要如何自動將它轉換成網址呢? '/^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4} ([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/' 參考網站: 37 Tested PHP, Perl, and JavaScript Regular Expressions http://tinyurl.com/lsd59j 裡面還有很多可以用的 http://tw.php.net/manual/en/function.preg-replace.php -- AppleBoy Blog: http://blog.wu-boy.com -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 115.43.14.208

10/03 18:28, , 1F
10/03 18:28, 1F

10/04 00:55, , 2F
樓上提供的文章,比較不嚴謹 ....
10/04 00:55, 2F

10/04 01:29, , 3F
我是比較好奇 有些網址參數遇到中文怎麼辦?
10/04 01:29, 3F

10/04 08:08, , 4F
正規的網址,是沒有中文的,需要經過編碼
10/04 08:08, 4F

10/04 08:22, , 5F
不過後面那段沒出來,不會用的人可能還是不會
10/04 08:22, 5F

10/04 10:21, , 6F
同意樓上..
10/04 10:21, 6F

10/04 11:52, , 7F

10/04 11:58, , 8F
XD接在一起說,好像被誤會了,是指取代的部分~
10/04 11:58, 8F
文章代碼(AID): #1AnnZBUg (PHP)
討論串 (同標題文章)
文章代碼(AID): #1AnnZBUg (PHP)