PHP: remove `http://` from link title

后端 未结 7 1422
终归单人心
终归单人心 2020-12-31 17:34

I have a string that looks like:

$string = \'http://google.com\';

How can I remove the http:

7条回答
  •  迷失自我
    2020-12-31 18:05

    Any simple regular expression or string replacement code is probably going to fail in the general case. The only "correct" way to do it is to actually parse the chunk as an SGML/XML snippet and remove the http:// from the value.

    For any other (reasonably short) string manipulation code, finding a counterexample that breaks it will be pretty easy.

提交回复
热议问题