{"id":2692,"date":"2018-10-25T17:30:50","date_gmt":"2018-10-25T09:30:50","guid":{"rendered":"https:\/\/www.webteach.tw\/?p=2692"},"modified":"2018-10-25T17:30:50","modified_gmt":"2018-10-25T09:30:50","slug":"how-to-remove-an-array-element-on-key-%e5%a6%82%e4%bd%95%e4%be%9d%e9%99%a3%e5%88%97key%e5%80%bc%e7%a7%bb%e9%99%a4%e6%9f%90%e5%80%8b%e9%99%a3%e5%88%97%e5%85%83%e7%b4%a0%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.webteach.tw\/?p=2692","title":{"rendered":"[ PHP ] &#8211; How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f<\/p>\n\n\n<p class=\"wp-block-paragraph\">\u5176\u5be6\u5f88\u55ae<br \/>\u8209\u4f8b\u6211\u6709\u500b<\/p>\n\n\n<p class=\"wp-block-paragraph\">\u4f46\u6709\u6642\u5019\u6709\u4e9b\u6b04\u4f4d\u662f\u4f60\u586bA\u6b04 B\u6b04\u5c31\u8b8a\u975e\u5fc5\u586b\uff0c\u586bB\u6b04 A\u6b04\u5c31\u8b8a\u975e\u5fc5\u586b,\u4e5f\u5c31\u662f\u5169\u6b04\u53ea\u8981\u4e00\u6b04\u6709\u503c\u5c31\u53ef\u4ee5\u3002<\/p>\n\n\n<pre class=\"wp-block-code\"><code>$a=array('a'=>'111','b'=>'222','c'=>'333');\nunset($a&#91;'a']);<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">\u9019\u500b\u5f8c\u5c31\u5224\u65b7<\/p>\n\n\n<pre class=\"wp-block-code\"><code>if($_POST&#91;'a']!=''){unset($a&#91;'b']);}\nif($_POST&#91;'b']!=''){unset($a&#91;'a']);}<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">\u9019\u6a23\u5c31\u53ef\u4ee5\u8b8a\u9078\u586b\uff0c\u4f46\u5169\u500b\u5fc5\u9700\u6709\u4e00\u500b\u6709\u503c<\/p>\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u6211\u7684\u4f7f\u7528\u60c5\u5883\u662f\uff0c\u6211\u6709\u500b\u9078\u64c7\u5668\uff0c\u6703\u53bb\u5224\u65b7\u524d\u7aef\u50b3\u4f86\u7684\u53c3\u6578\u90a3\u4e9b\u662f\u4e0d\u53ef\u4ee5\u70ba\u7a7a\u503c\uff0c\u4e5f\u5c31\u662f\u5fc5\u586b\u7684\u6b04\u4f4d\u3002\u6211\u4ee5\u4e00\u500b\u9663\u5217\u5b58\u90a3\u4e9b\u6b04\u4f4d\u662f\u5fc5\u586b\u7684<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to remove an array el&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43,36],"tags":[121,448,486,586],"class_list":["post-2692","post","type-post","status-publish","format-standard","hentry","category-array","category-php","tag-array","tag-php","tag-remove-an-array-element-on-key","tag-unset"],"_links":{"self":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/2692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2692"}],"version-history":[{"count":0,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/2692\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}