您当前的位置: 首页 >  ios

培根芝士

暂无认证

  • 0浏览

    0关注

    446博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

iOS中NSURL常用属性

培根芝士 发布时间:2020-03-17 11:39:55 ,浏览量:0

 

    NSString *urlstr = @"http://api.test.com:8080/test/index.php?g=api&m=base&a=skyuv&city=110229";
    NSURL *url = [NSURL URLWithString:urlstr];
    NSLog(@"scheme:%@", url.scheme);                    //协议 http
    NSLog(@"host:%@", url.host);                        //域名 api.test.com
    NSLog(@"port:%@", url.port);                        //端口 8080
    NSLog(@"absoluteString:%@", url.absoluteString);    //完整的url字符串
    NSLog(@"relativePath: %@", url.relativePath);       //相对路径 /test/index.php
    NSLog(@"path: %@", url.path);                       //路径 /test/index.php
    NSLog(@"pathComponents:%@", url.pathComponents);    //("/",test,"index.php")
    NSLog(@"Query:%@", url.query);                      //参数 g=api&m=base&a=skyuv&city=110229

 

关注
打赏
1660824269
查看更多评论
立即登录/注册

微信扫码登录

0.0415s