{"id":502,"date":"2017-09-26T21:54:47","date_gmt":"2017-09-26T13:54:47","guid":{"rendered":"http:\/\/www.huike007.cn\/?p=502"},"modified":"2017-09-26T21:56:22","modified_gmt":"2017-09-26T13:56:22","slug":"php%e5%a4%9a%e6%9d%a1%e4%bb%b6%e6%90%9c%e7%b4%a2","status":"publish","type":"post","link":"http:\/\/www.huike007.cn\/?p=502","title":{"rendered":"PHP\u591a\u6761\u4ef6\u641c\u7d22"},"content":{"rendered":"<p>PHP\u591a\u6761\u4ef6\u6a21\u7cca\u641c\u7d22<br \/>\n###############################<br \/>\n<?php  \n\/\/\u5b9e\u73b0\u4e24\u4e2a\u903b\u8f91  \n\/\/1.\u5982\u679c\u6ca1\u6709post\u6570\u636e.\u67e5\u6240\u6709\u7684  \n\/\/2.\u5982\u679c\u6709post\u6570\u636e.\u6839\u636e\u6761\u4ef6\u67e5  \n$db = new mysqli(\"localhost\",\"root\",\"12345678\",\"heiheihei\");  \n\/\/\u8fde\u63a5\u6570\u636e\u5e93  \n$tj1 = \" 1 = 1 \";  \n$tj2 = \" 1 = 1 \";\n\/\/\u4e24\u4e2a\u6761\u4ef6\u7684\u6052\u7b49  \n$name=\"\";  \n\/\/\u6052\u6210\u7acb\uff0c\u5982\u679c\u6ca1\u6709\u5199\u6570\u636e\uff0c\u90a3\u5c31\u8ba9\u6761\u4ef6\u7b49\u4e8e1=1\uff0c\u8fd9\u4e2a\u6761\u4ef6\u662f\u67e5\u627e\u6240\u6709\u7684\u6570\u636e  \n\/\/\u5982\u679c\u4f60\u5199\u5165\u6570\u636e\uff0c\u6309\u7167\u6570\u636e\u67e5  \nif(!empty($_POST[\"name\"])) \n\/\/\u7b2c\u4e00\u4e2a\u6761\u4ef6\u7684\u5224\u65ad\uff08\u7528\u5230\u4e86\u6a21\u7cca\u67e5\u8be2\uff09  \n{    \n$name = $_POST['name'];    \n$tj1 = \" name like '%{$name}%'\";  \n}  \nif(!empty($_POST[\"tel\"]))  \n{    \n$tel = $_POST[\"tel\"];    \n$tj2 = \"tel like '%{$tel}%'\";  \n}  \n\/\/\u5c06\u6761\u4ef6\u62fc\u63a5\u5230SQl\u8bed\u53e5  \n$sql = \"select * from contacts WHERE {$tj1} AND {$tj2}\";\n##########################################################\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u591a\u6761\u4ef6\u6a21\u7cca\u641c\u7d22 ###############################<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[180],"tags":[386,392,393],"_links":{"self":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/502"}],"collection":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=502"}],"version-history":[{"count":2,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/502\/revisions"}],"predecessor-version":[{"id":504,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/502\/revisions\/504"}],"wp:attachment":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}