2023-05-08

2023-05-07  本文已影响0人  ZM_微笑向阳

get 请求编码 格式

      et url = "https://www.google.com/search?q=成都市"//编码
      //let url = appStoreURL.addingPercentEscapes(using: String.Encoding.utf8) //iOS7之前
      let newUrl = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! // iOS 9之后。
      print("编码过后的url:\(newUrl)") //编码过后的url:https://www.google.com/search?                                 q=%E6%88%90%E9%83%BD%E5%B8%82 
上一篇 下一篇

猜你喜欢

热点阅读