{"id":255,"date":"2014-11-06T21:45:27","date_gmt":"2014-11-06T13:45:27","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=255"},"modified":"2016-07-15T17:22:16","modified_gmt":"2016-07-15T09:22:16","slug":"ios%e5%bc%80%e5%8f%91post%e8%af%b7%e6%b1%82%e5%9f%ba%e6%9c%ac%e6%ad%a5%e9%aa%a4%e4%b8%8e%e5%ae%9e%e7%8e%b0%e6%96%b9%e6%b3%95%ef%bc%88%e9%99%84post%e8%af%b7%e6%b1%82%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%a1%b5","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2014\/11\/06\/214527255.html","title":{"rendered":"iOS\u5f00\u53d1Post\u8bf7\u6c42\u57fa\u672c\u6b65\u9aa4\u4e0e\u5b9e\u73b0\u65b9\u6cd5\uff08\u9644Post\u8bf7\u6c42\u670d\u52a1\u5668\u9875\u9762\uff09"},"content":{"rendered":"<p><strong>\u4e00\u3001\u57fa\u672c\u6b65\u9aa4<\/strong><\/p>\n<p>1\u3001\u521b\u5efaURL\u5b57\u7b26\u4e32\uff0c\u5373\u7f51\u5740<br \/>\n2\u3001\u521b\u5efaURL\uff0c\u5373\u521b\u5efa\u4e00\u4e2a\u9700\u8981\u8bf7\u6c42\u7684\u8d44\u6e90<br \/>\n3\u3001\u521b\u5efa\u4e00\u4e2a\u8bf7\u6c42<br \/>\n4\u3001\u521b\u5efaPOST\u8bf7\u6c42\u4f53<br \/>\n5\u3001\u53d1\u8d77\u8fde\u63a5<br \/>\n6\u3001\u63a5\u6536\u6570\u636e<\/p>\n<p><strong>\u4e8c\u3001\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><!--more--><\/p>\n<pre lang=\"objc\" line=\"1\">    \/\/ 1\u3001\u521b\u5efaURL\u5b57\u7b26\u4e32\uff0c\u5373\u7f51\u5740\n    NSString *string = @\"http:\/\/www.yusian.com\/test\/post.php\";\n    \n    \/\/ 2\u3001\u521b\u5efaURL\uff0c\u5373\u521b\u5efa\u4e00\u4e2a\u9700\u8981\u8bf7\u6c42\u7684\u8d44\u6e90\n    NSURL *url = [NSURL URLWithString:string];\n    \n    \/\/ 3\u3001\u521b\u5efa\u4e00\u4e2a\u8bf7\u6c42\n    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\n    \n    \/\/ 4\u3001\u521b\u5efaPOST\u8bf7\u6c42\u4f53\n    NSString *bodyString = @\"user=yusian&amp;pass=123\";\n    NSData *data = [bodyString dataUsingEncoding:NSUTF8StringEncoding];\n    request.HTTPMethod = @\"post\";\n    request.timeoutInterval = 5.0f;\n    request.HTTPBody = data;\n    \n    \/\/ 5\u3001\u540c\u6b65\u8bf7\u6c42\u65b9\u6cd5\n    NSURLResponse *response = nil;\n    NSError *error = nil;\n    NSData *result = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error];\n    \n    \/\/ 6\u3001\u8f93\u51fa\u8bf7\u6c42\u7ed3\u679c\n    NSLog(@\"%@\", [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding]);<\/pre>\n<p><strong>\u4e09\u3001Post\u670d\u52a1\u5668\u642d\u5efa<\/strong><\/p>\n<p>\u4e0a\u8ff0\u5728\u672c\u7ad9\u70b9\u7684\u9875\u9762\u4e0a\u9a8c\u8bc1\uff0c\u7528\u6237\u540d\u4e3ayusian\u5bc6\u7801123\uff0c\u5982\u679c\u6709\u9700\u8981\u53ef\u81ea\u5df1\u642d\u5efaphp\u670d\u52a1\u5668\u8fdb\u884c\u9a8c\u8bc1\uff0c\u5199\u4e00\u4e2a\u7b80\u5355\u7684php\u9875\u9762\u63a5\u6536post\u8bf7\u6c42\uff0c\u6839\u636e\u8bf7\u6c42\u8fd4\u56de\u76f8\u5e94\u9a8c\u8bc1\u7ed3\u679c\u3002<br \/>\n\u6e90\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre lang=\"php\" line=\"1\"><?php\n$username = \"yusian\";  \/\/ \u7528\u6237\u540d\uff08\u53ef\u81ea\u884c\u4fee\u6539\uff09\n$password = \"123\";     \/\/ \u5bc6\u7801\uff08\u53ef\u81ea\u884c\u4fee\u6539\uff09\n$p = \"\"; \n\nif(empty($_POST[\"pass\"]) || empty($_POST[\"user\"])){ \n        $p = \"\u53c2\u6570\u4f20\u9012\u9519\u8bef\uff0c\u793a\u4f8b\uff1auser=yusian&#038;pass=123\"; \n}else{ \n        if($_POST[\"user\"] == $username &#038;&#038; $_POST[\"pass\"] == $password){\n                $p = \"\u9a8c\u8bc1\u6210\u529f...\";        \n        }else{        \n                $p = \"\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef...\"; \n        }        \n} \necho $p;\n?>  <\/pre>\n<p>Demo\u4e0b\u8f7d\uff1a<a href=\"http:\/\/www.yusian.com\/blog\/wp-content\/uploads\/2016\/07\/Test-1.zip\">Test<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u57fa\u672c\u6b65\u9aa4 1\u3001\u521b\u5efaURL\u5b57\u7b26\u4e32\uff0c\u5373\u7f51\u5740 2\u3001\u521b\u5efaURL\uff0c\u5373\u521b\u5efa\u4e00\u4e2a\u9700\u8981\u8bf7\u6c42\u7684\u8d44\u6e90 3\u3001\u521b\u5efa\u4e00\u4e2a\u8bf7\u6c42 4\u3001\u521b\u5efaPOST\u8bf7\u6c42\u4f53 5\u3001\u53d1\u8d77\u8fde\u63a5 6\u3001\u63a5\u6536\u6570\u636e \u4e8c\u3001\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[20,15,17,18],"class_list":["post-255","post","type-post","status-publish","format-standard","hentry","category-project","tag-basics","tag-module","tag-skill","tag-network"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=255"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}