开发者

Find to extract portion of a string in PHP [duplicate]

This que开发者_如何学编程stion already has answers here: Closed 11 years ago.

Possible Duplicate:

how do i parse url php

I have strings in the format of 'http://www.example.com/', some of them have the trailing slash, and other don't, how would I extract 'example.com' from them?


Use parse_url. You want the host component. Once you have that, you can remove the www. if it exists.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜