php - NSURL with\n 调用 php 文件

标签 php ios hyperlink newline nsurl

我正在使用以下代码行来运行我在服务器上的 php 文件。问题是\n 导致错误并禁止调用 php 文件。但是当我删除\n 时它起作用了。

  NSString *link = [[NSString alloc]initWithFormat:@"%@?message=%@",link,[@"hello   world\nhello" stringByReplacingOccurrencesOfString:@" " withString:@"%20"]];
  NSData *resultData = [NSData dataWithContentsOfURL:[NSURL URLWithString:link]];

我不知道该怎么做才能完成这项工作。除了\n 之外,还有什么我需要使用的吗?!

谢谢

最佳答案

试试这个:

NSString *link = [[NSString alloc]initWithFormat:@"%@?message=hello world%@hello",link,@"\n"];
NSData *resultData = [NSData dataWithContentsOfURL:[NSURL URLWithString:link]];

关于php - NSURL with\n 调用 php 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11166851/

相关文章:

html - 超链接在gmail中不可点击

php - 根据订单栏显示产品订单

php - 如何使用ckeditor更新php ajax中的textarea值?

ios - 安排交互式 UILocalNotification - Obj-C

javascript - 将 url 的内容发送到打印机

html - 导航中的按钮而不是 anchor ?

php - 用 PHP 解析字符串

php - 无法通过 PDO 插入 mysql

ios - 如何通过按钮重新获得互联网后重新加载tableView

ios - 是否有可能将浮点值存储到 id?