NSURL

作者: 会飞的大西瓜v | 来源:发表于2018-11-12 20:48 被阅读7次
NSURL *url = [NSURL URLWithString:@"http://m.test.68mall.com/package.html?sku_id=2902"];

NSLog(@"scheme:%@", [url scheme]); //协议 http

NSLog(@"host:%@", [url host]);     //域名 m.test.68mall.com

NSLog(@"absoluteString:%@", [url absoluteString]); //完整的url字符串 http://m.test.68mall.com/package.html?sku_id=2902  

NSLog(@"relativePath: %@", [url relativePath]); //相对路径 search

NSLog(@"port :%@", [url port]);  // 端口 8080

NSLog(@"path: %@", [url path]);  // 路径

NSLog(@"pathComponents:%@", [url pathComponents]); 

NSLog(@"Query:%@", [url query]);  //参数 sku_id=2902

相关文章

网友评论

      本文标题:NSURL

      本文链接:https://www.haomeiwen.com/subject/wxhhfqtx.html