{"id":31446,"date":"2024-11-25T11:50:50","date_gmt":"2024-11-25T03:50:50","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31446\/"},"modified":"2024-11-25T11:50:50","modified_gmt":"2024-11-25T03:50:50","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%ae%9e%e7%8e%b0%e4%b8%8e%e5%90%8e%e5%8f%b0php%e4%ba%a4%e4%ba%92","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31446\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u4e0e\u540e\u53f0PHP\u4ea4\u4e92"},"content":{"rendered":"<p>\u63a5\u4e0b\u6765\u5c06\u8bb2\u540e\u53f0\u5982\u4f55\u4e0e\u524d\u53f0\u8fdb\u884c\u6570\u636e\u53ca\u56fe\u7247\u4e4b\u95f4\u7684\u4ea4\u4e92\uff0c\u76f8\u4fe1\u8fd9\u4e00\u70b9\u662f\u5f88\u591a\u4eba\u6240\u5173\u6ce8\u7684\uff0c\u56e0\u4e3a\u5f53\u65f6\u6211\u5b9e\u5728\u56e2\u961f\u4e2d\u8d1f\u8d23\u540e\u53f0\u5f00\u53d1\uff0c\u56e0\u6b64\u5bf9\u524d\u7aef\u4e0d\u662f\u7279\u522b\u4e86\u89e3\uff0c\u8fd9\u91cc\u6211\u4f1a\u8d34\u51fa\u524d\u7aef\u5f00\u53d1\u65f6\u7684\u90e8\u5206\u4ee3\u7801\u622a\u56fe\uff0c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5b98\u65b9api\u4ecb\u7ecd\u5730\u5740\u662f\uff1a<\/p>\n<p><span style=\"text-align:left\">&nbsp;&nbsp;&nbsp;&nbsp;https:\/\/mp.weixin.qq.com\/debug\/wxadoc\/dev\/api\/api-network.html<br \/><\/span><\/p>\n<p style=\"text-align:left\">\u5fae\u4fe1\u4e0e\u540e\u53f0\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u6570\u636e\u901a\u4fe1\u662f\u8c03\u7528wx.request(OBJECT)\u5b9e\u73b0\u7684\uff0c\u5b98\u65b9api\u63a5\u53e3\u91cc\u6709\u5bf9\u6b64\u8bf4\u660e\uff0c<\/p>\n<p style=\"text-align:left\">\u4f8b\u5982\u524d\u53f0\u5411\u540e\u53f0\u53d1\u9001\u6570\u636e\uff0c\u9700\u8981\u94fe\u63a5\u670d\u52a1\u5668php\u4f5c\u7528\u8def\u5f84\u4e0b\u7684\u5177\u4f53php\u6587\u4ef6\uff0c\u5e76\u4ee5key-value\u5f62\u5f0f\u5c01\u88c5json\u683c\u5f0f\u6570\u636e\uff0c\u8bf7\u770b\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<p style=\"text-align:center\">&nbsp;&nbsp;&nbsp;&nbsp;<img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/52e9cc6e76fff9d263516628258d8329-0.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u4e0e\u540e\u53f0PHP\u4ea4\u4e92\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u4e0e\u540e\u53f0PHP\u4ea4\u4e92\u63d2\u56fe\" \/><\/p>\n<p style=\"text-align:left\">url\u662f\u670d\u52a1\u5668\u7684\u57df\u540d\u53caisbn.php\u5728\u670d\u52a1\u5668\u7684\u4f4d\u7f6e\uff0c\u8fd9\u4e2a\u4f4d\u7f6e\u662f\u76f8\u5bf9\u4f4d\u7f6e\uff0c\u5728\u6211\u4e0a\u4e00\u7bc7\u8d2d\u4e70\u7684\u955c\u50cf\u91cc\u9ed8\u8ba4php\u6587\u4ef6\u8def\u5f84\u4e3a\uff1a<\/p>\n<p style=\"text-align:left\">&nbsp; &nbsp;<span style=\"font-size:14px\">\/yjdata\/www\/ &nbsp;<\/span><span><span style=\"font-size:14px\">\uff0c\u8fd9\u5c31\u610f\u5473\u7740\u76f4\u63a5\u653e\u5728\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e0b\u7684php\u53ea\u9700\u8981\u5728\u57df\u540d\u540e\u76f4\u63a5\/+*.php\u5373\u53ef\uff0c\u5982\u679c\u4e3a\u4e86\u65b9\u4fbf\u7ba1\u7406\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u5efa\u4e86\u4e00\u4e2a\u6587\u4ef6\u5939\u5219\u5728\u57df\u540d\u540e\/\u6587\u4ef6\u5939\u540d\u5b57\/*.php\u5373\u53ef\u3002<\/span><\/span><\/p>\n<p style=\"text-align:left\"><span style=\"text-align:left\">&nbsp;&nbsp;&nbsp;&nbsp;\u6b64\u5916\u524d\u7aef\u5411\u540e\u53f0\u4f20\u8f93\u7684\u6570\u636e\u662f\u4ee5json\u683c\u5f0f\u5c01\u88c5\u7684\uff0c\u5982\u56fe\u4e2d\u7684data\u91cc\u5199\u7684\u6570\u636e\uff0c\u524d\u9762\u662fkey\uff0c\u540e\u9762\u662f\u5177\u4f53\u7684value\u503c\uff0c\u540e\u53f0\u53d6\u5f97\u65f6\u5019\u662f\u8981\u6839\u636e\u524d\u9762\u7684key\u503c\u53d6\u503c\uff0c\u6b64\u5916\uff0cmethod\u51b3\u5b9a\u4e86\u540e\u53f0\u4e0e\u524d\u53f0\u901a\u8fc7\u4ec0\u4e48\u65b9\u5f0f\u4ea4\u6d41\uff0c\u8fd9\u91cc\u662f\u7528\u7684GET\u65b9\u6cd5\uff0c\u540e\u53f0\u4e0e\u524d\u53f0\u65b9\u6cd5\u5fc5\u987b\u914d\u5bf9\u4f7f\u7528\uff0c\u4e0d\u80fd\u4e00\u4e2a\u662fGET\uff0c\u53e6\u4e00\u7aef\u662fPOST\uff0c\u5728\u505a\u5fae\u4fe1\u652f\u4ed8\u529f\u80fd\u65f6\uff0c\u6709\u4e9b\u5b89\u5168\u6027\u9690\u79c1\u6027\u8f83\u9ad8\u7684\u6570\u636e\u5fc5\u987b\u91c7\u7528POST\u8fdb\u884c\u4ea4\u4e92\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span style=\"text-align:left\">&nbsp; &nbsp; \u8fd9\u91cc\u7684\u524d\u7aef\u5411\u540e\u53f0\u4f20\u8f93\u7684result\u662f\u56fe\u4e66\u7684ISBN\u7801\uff0c\u56e0\u4e3a\u6211\u4eec\u505a\u7684\u5c0f\u7a0b\u5e8f\u6709\u4e2a\u529f\u80fd\u662f\u8c03\u7528\u76f8\u673a\u626b\u63cf\u4e66\u672c\u540e\u9762\u7684\u6761\u5f62\u7801\u4ece\u800c\u83b7\u5f97ISBN\u7801\uff0c\u524d\u7aef\u5c06ISBN\u7801\u53d1\u9001\u5230\u540e\u53f0\uff0c\u540e\u53f0\u7a0b\u5e8f\u5c06\u8c03\u7528\u7b2c\u4e09\u65b9\u8c46\u74e3\u56fe\u4e66\u63a5\u53e3\u6765\u4f9d\u636eISBN\u7801\u67e5\u8be2\u56fe\u4e66\u4fe1\u606f\uff0c\u5e76\u5c06\u56fe\u4e66\u4fe1\u606f\u8fd4\u56de\u7ed9\u524d\u53f0\uff0c\u8fd9\u91cc\u6211\u8d34\u51fa\u670d\u52a1\u5668\u7aef\u7684\u4ee3\u7801\u4f9b\u5927\u5bb6\u53c2\u8003\uff1a<br \/><\/span><\/p>\n<p style=\"text-align:left\"><span style=\"text-align:left\"><\/span><\/p>\n<pre>&lt;?php $result=$_GET[\"result\"];\/*\u83b7\u53d6\u524d\u7aef\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u626b\u4e66\u7684isbn\u7ed3\u679c*\/<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>\/*\u4e0e\u7b2c\u4e09\u65b9\u63a5\u53e3\u901a\u4fe1\u83b7\u53d6\u4e66\u672c\u4fe1\u606f*\/<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>$book_info=file_get_contents(\"https:\/\/api.douban.com\/v2\/book\/isbn\/:\".$result);$jsondecode&nbsp;=&nbsp;json_decode($book_info,true);\/*\u5c06\u83b7\u53d6\u5230\u7684\u4e66\u672c\u4fe1\u606fJSON\u89e3\u7801*\/$title=$jsondecode[\"title\"];\/*\u5c06\u89e3\u7801\u540e\u4e66\u540d\u8d4b\u503c\u7ed9title\u53d8\u91cf*\/$author=$jsondecode[\"author\"];\/*\u5c06\u89e3\u7801\u540e\u4f5c\u8005\u8d4b\u503c\u7ed9author\u53d8\u91cf*\/$publisher=$jsondecode[\"publisher\"];\/*\u5c06\u89e3\u7801\u540e\u51fa\u7248\u793e\u540d\u8d4b\u503c\u7ed9publisher\u53d8\u91cf*\/echo&nbsp;\"title=\".$title;&nbsp;\/*\u5411\u524d\u7aef\u8fd4\u56de\u4e66\u540d*\/echo&nbsp;\"author=\".$author;&nbsp;\/*\u5411\u524d\u7aef\u8fd4\u56de\u4f5c\u8005\u540d*\/echo&nbsp;\"publisher=\".$publisher;&nbsp;\/*\u5411\u524d\u7aef\u8fd4\u56de\u51fa\u7248\u793e\u540d*\/?&amp;gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"text-align:left\">&nbsp;&nbsp;&nbsp;&nbsp;\u5177\u4f53\u7684\u6ce8\u91ca\u90fd\u5199\u5f97\u5f88\u8be6\u7ec6\uff0c\u5411\u524d\u53f0\u8fd4\u56de\u6570\u636e\u5219\u76f4\u63a5\u7528echo\u5373\u53ef\uff0c\u4e00\u822c\u5f00\u53d1\u90fd\u8981\u4e0e\u6570\u636e\u5e93\u6253\u4ea4\u9053\uff0c\u56e0\u6b64\uff0c\u540e\u53f0\u7a0b\u5e8f\u5c31\u9700\u8981\u4f9d\u636e\u524d\u53f0\u4f20\u6765\u7684\u6570\u636e\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u64cd\u4f5c\uff0c\u8fd9\u4e00\u90e8\u5206\u5176\u5b9e\u4e5f\u5c31\u662f\u63a5\u53d7\u524d\u53f0\u7684\u6570\u636e\uff0c\u6267\u884c\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u8fd9\u4e00\u90e8\u5206\u53ea\u8981\u662f\u8bb2\u5230php\u6570\u636e\u5e93\u64cd\u4f5c\u7684\u90fd\u4f1a\u6709\uff0c\u8fd9\u91cc\u6211\u4e0d\u518d\u8fdb\u884c\u8fc7\u591a\u9610\u8ff0\u3002<\/span><\/p>\n<p><span style=\"text-align:left\">&nbsp; &nbsp; \u6b64\u5916\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u6765\u8bf4\uff0c\u56fe\u7247\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u800c\u56fe\u7247\u8d44\u6e90\u90fd\u662f\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e2d\u7684\uff0c\u56e0\u6b64\u5982\u4f55\u5bf9\u56fe\u7247\u8fdb\u884c\u5b58\u50a8\u662f\u4e00\u4e2a\u5173\u952e\u3002\u63a5\u4e0b\u6765\u5c06\u7ed3\u5408\u4e00\u4e2a\u4e66\u672c\u4fe1\u606f\u7684\u5177\u4f53\u63d2\u5165\u6570\u636e\u5e93\u7684\u8fc7\u7a0b\u6765\u8fdb\u884c\u8bb2\u89e3\u3002\u3002\u3002\uff08\u5176\u5b9e\u6ce8\u91ca\u7279\u522b\u8be6\u7ec6\uff09<br \/><\/span><\/p>\n<p><span style=\"text-align:left\"><\/span><\/p>\n<pre>&lt;?phpheader (&#039;content-type:application\/json;charset=utf8&#039;);$mysql_server_name=\"localhost\";\/*\u6570\u636e\u5e93\u670d\u52a1\u5668\u540d\u79f0*\/$mysql_username=\"root\";\/*\u6570\u636e\u5e93\u7528\u6237\u540d*\/$mysql_password=\"123456\";\/*\u6570\u636e\u5e93\u7528\u6237\u5bc6\u7801*\/$mysql_databasename=\"zhishu\";\/*\u8fdb\u5165\u6570\u636e\u5e93\u540e\u6570\u636e\u5e93\u540d*\/$conn=mysqli_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_databasename);\/*\u6570\u636e\u5e93\u8fde\u63a5\u8bed\u53e5*\/;;$bookname=$_POST[\"bookname\"];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u540d\u5b57*\/$authorname=$_POST[\"authorname\"];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u4f5c\u8005\u540d\u5b57*\/$bookintroduce=$_POST[\"introduce\"];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u4ecb\u7ecd\u4fe1\u606f*\/$bookholder_name=$_POST[\"openid\"];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u6301\u6709\u4eba\u6635\u79f0*\/$bookclass=$_POST[&#039;classification&#039;];;\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u5206\u7c7b*\/date_default_timezone_set(&#039;PRC&#039;); \/*\u8bbe\u7f6e\u9ed8\u8ba4\u65f6\u533a\u4e3a\u4e2d\u56fd*\/$time=(string)date(\"Y-m-d-h-i\",time());\/*\u83b7\u53d6\u65f6\u95f4*\/function Unioname($a) \/*\u5c06\u65f6\u95f4\u683c\u5f0f\u66f4\u6539\u7684\u51fd\u6570*\/{\r\n    $a=explode(&#039;-&#039;,$a);\r\n    $a=implode(&#039;&#039;,$a);\r\n    return $a;\r\n}$time=Unioname($time);$allowedExts = array(\"gif\", \"jpeg\", \"jpg\", \"png\"); \/*\u8fd9\u91cc\u7684\u5185\u5bb9\u540c\u7528\u6237\u6ce8\u518c\u65f6\u4ee3\u7801\u542b\u4e49\u4e00\u6837\uff0c\u53ea\u4e0d\u8fc7\u90a3\u65f6\u662f\u4e3a\u4e86\u5b58\u7528\u6237\u5934\u50cf\u5e76\u4fee\u6539\u7528\u6237\u5934\u50cf\u540d\u5b57\uff0c\u8fd9\u91cc\u662f\u5b58\u4e66\u672c\u56fe\u50cf\u5e76\u4fee\u6539\u4e66\u672c\u56fe\u50cf\u7684\u540d\u5b57*\/$temp = explode(\".\", $_FILES[\"file\"][\"name\"]);\/\/\u5c06\u56fe\u7247\u540d\u5b57\u4ee5.\u5206\u5272\u6210\u4e24\u4e2a\u5b57\u7b26\u4e32$extension = end($temp);     \/\/ \u83b7\u53d6\u56fe\u7247\u540e\u7f00\u540dif ((($_FILES[\"file\"][\"type\"] == \"image\/gif\")\r\n        || ($_FILES[\"file\"][\"type\"] == \"image\/jpeg\")\r\n        || ($_FILES[\"file\"][\"type\"] == \"image\/jpg\")\r\n        || ($_FILES[\"file\"][\"type\"] == \"image\/pjpeg\")\r\n        || ($_FILES[\"file\"][\"type\"] == \"image\/x-png\")\r\n        || ($_FILES[\"file\"][\"type\"] == \"image\/png\"))\r\n    &amp;&amp; ($_FILES[\"file\"][\"size\"] &lt; 1024000)   \/\/ \u5c0f\u4e8e 1MB\r\n    &amp;&amp; in_array($extension, $allowedExts))\r\n{\r\n    if ($_FILES[\"file\"][\"error\"] &gt;&nbsp;0)&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;\"\u9519\u8bef\uff1a:&nbsp;\"&nbsp;.&nbsp;$_FILES[\"file\"][\"error\"]&nbsp;.&nbsp;\"&lt;br&gt;\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u5224\u65ad\u5f53\u671f\u76ee\u5f55\u4e0b\u7684&nbsp;upload&nbsp;\u76ee\u5f55\u662f\u5426\u5b58\u5728\u8be5\u6587\u4ef6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u5982\u679c\u6ca1\u6709&nbsp;upload&nbsp;\u76ee\u5f55\uff0c\u4f60\u9700\u8981\u521b\u5efa\u5b83\uff0cupload&nbsp;\u76ee\u5f55\u6743\u9650\u4e3a&nbsp;777\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(file_exists(\"bookimage\/\"&nbsp;.&nbsp;$_FILES[\"file\"][\"name\"]))&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$_FILES[\"file\"][\"name\"]&nbsp;.&nbsp;\"&nbsp;\u6587\u4ef6\u5df2\u7ecf\u5b58\u5728\u3002&nbsp;\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u5982\u679c&nbsp;upload&nbsp;\u76ee\u5f55\u4e0d\u5b58\u5728\u8be5\u6587\u4ef6\u5219\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230&nbsp;upload&nbsp;\u76ee\u5f55\u4e0b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move_uploaded_file($_FILES[\"file\"][\"tmp_name\"],&nbsp;\"bookimage\/\".$_FILES[\"file\"][\"name\"]);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$oldname&nbsp;=&nbsp;\"bookimage\/\"&nbsp;.&nbsp;$_FILES[\"file\"][\"name\"];\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$newname&nbsp;=&nbsp;\"bookimage\/\"&nbsp;.&nbsp;$time&nbsp;.$bookholder_name.\".\".$extension;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rename($oldname,&nbsp;$newname);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_num=\"select&nbsp;*&nbsp;from&nbsp;book\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reasult=mysqli_query($conn,$sql_num);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$reasult_num=mysqli_num_rows($reasult);&nbsp;\/*\u5c06\u83b7\u53d6\u5230\u4e66\u672c\u4fe1\u606f\u63d2\u5165\u6570\u636e\u5e93\u8bed\u53e5*\/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_insert=\"insert&nbsp;into&nbsp;book&nbsp;(book_id,bookname,authorname,book_intro,bookclass,bookholder_openid,bookpicture_path,is_CunZai,ChengJiao_num)&nbsp;VALUES&nbsp;($reasult_num+1,'$bookname','$authorname','$bookintroduce','$bookclass','$bookholder_openid','$newname','1',0)\";<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;mysqli_query($conn,$sql_insert))\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;\"\u63d2\u5165\u4e66\u7c4d\u6210\u529f\uff01\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;\"\u63d2\u5165\u5931\u8d25\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n}mysqli_close($conn);&nbsp;\/*\u5173\u95ed\u6570\u636e\u5e93\u8fde\u63a5*\/?&amp;gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"text-align:left\">\u9996\u5148\u4f7f\u7528$[FILE]\u5168\u5c40\u6570\u7ec4\u63a5\u53d7\u6587\u4ef6\uff0c\u5176\u62e5\u6709\u7684\u51e0\u4e2a\u5c5e\u6027\u5982\u4e0b\uff1a<\/span><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><span style=\"text-align:left\">$_FILES[&#8220;file&#8221;][&#8220;name&#8221;] &#8211; \u88ab\u4e0a\u4f20\u6587\u4ef6\u7684\u540d\u79f0<\/span><\/p>\n<p><span style=\"text-align:left\">$_FILES[&#8220;file&#8221;][&#8220;type&#8221;] &#8211; \u88ab\u4e0a\u4f20\u6587\u4ef6\u7684\u7c7b\u578b<\/span><\/p>\n<p><span style=\"text-align:left\">$_FILES[&#8220;file&#8221;][&#8220;size&#8221;] &#8211; \u88ab\u4e0a\u4f20\u6587\u4ef6\u7684\u5927\u5c0f\uff0c\u4ee5\u5b57\u8282\u8ba1<br \/>$_FILES[&#8220;file&#8221;][&#8220;tmp_name&#8221;] &#8211; \u5b58\u50a8\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7684\u4e34\u65f6\u526f\u672c\u7684\u540d\u79f0<br \/>$_FILES[&#8220;file&#8221;][&#8220;error&#8221;] &#8211; \u7531\u6587\u4ef6\u4e0a\u4f20\u5bfc\u81f4\u7684\u9519\u8bef\u4ee3\u7801<br \/>\u8fd9\u662f\u4e00\u79cd\u975e\u5e38\u7b80\u5355\u6587\u4ef6\u53d1\u9001\u53ca\u63a5\u6536\u65b9\u5f0f\uff0c\u63a5\u6536\u5230\u4ee5\u540e\u5bf9\u6587\u4ef6\u540d\u5b57\u8fdb\u884c\u4ee5\u201c.\u201d\u8fdb\u884c\u5206\u5272\uff0c\u8fd9\u662f\u4e3a\u4e86\u83b7\u53d6\u540e\u7f00\uff0c\u63a5\u4e0b\u6765\u8981\u5bf9\u540e\u7f00\u8fdb\u884c\u5224\u65ad\uff0c\u770b\u662f\u5426\u662f\u5e38\u7528\u7684\u56fe\u7247\u540e\u7f00\u683c\u5f0f\uff0c\u5982\u679c\u662f\u5e76\u4e14\u56fe\u7247\u5927\u5c0f\u5c0f\u4e8e1MB\uff0c\u5219\u8fdb\u884c\u63a5\u4e0b\u6765\u7684\u64cd\u4f5c\uff0c\u6b64\u65f6\u56fe\u7247\u4f4d\u4e8e\u7f13\u5b58\u533a\uff0c\u56e0\u6b64\u5fc5\u987b\u5c06\u56fe\u7247\u6539\u540d\u540e\u5b58\u4e8e\u56fe\u4e66\u56fe\u7247\u7684\u6587\u4ef6\u5939\u4e0b\uff0c\u8fd9\u4e00\u90e8\u5206\u5728\u4ee3\u7801\u91cc\u6709\u5b9e\u73b0\uff0c\u6b64\u5916\uff0c\u8fd8\u9700\u8981\u5c06\u56fe\u7247\u7684\u8def\u5f84\u4e0e\u8be5\u56fe\u4e66\u5176\u4ed6\u4fe1\u606f\u4e00\u8d77\u5b58\u5230\u6570\u636e\u5e93\u91cc\u3002\u5230\u8fd9\u91cc\u57fa\u672c\u5c0f\u7a0b\u5e8f\u4e0e\u540e\u53f0\u5927\u90e8\u5206\u80fd\u7528\u5230\u7684\u4ea4\u4e92\u6211\u90fd\u5728\u8fd9\u91cc\u8bb2\u4e86\uff0c\u57fa\u672c\u53ef\u4ee5\u5b8c\u6210\u4e00\u4e2a\u7b80\u5355\u7684\u5c0f\u7a0b\u5e8f\u3002<\/span><\/p>\n<p><span style=\"text-align:left\">\u76f8\u5173\u63a8\u8350\uff1a<\/span><\/p>\n<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u4e0e\u540e\u53f0PHP\u4ea4\u4e92\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u4e0b\u6765\u5c06\u8bb2\u540e\u53f0\u5982\u4f55\u4e0e\u524d\u53f0\u8fdb\u884c\u6570\u636e\u53ca\u56fe\u7247\u4e4b\u95f4\u7684\u4ea4\u4e92\uff0c\u76f8\u4fe1\u8fd9\u4e00\u70b9\u662f\u5f88\u591a\u4eba\u6240\u5173\u6ce8\u7684\uff0c\u56e0\u4e3a\u5f53\u65f6\u6211\u5b9e\u5728\u56e2\u961f\u4e2d\u8d1f\u8d23\u540e\u53f0\u5f00\u53d1\uff0c\u56e0\u6b64\u5bf9\u524d\u7aef\u4e0d\u662f\u7279\u522b\u4e86\u89e3\uff0c\u8fd9\u91cc\u6211\u4f1a\u8d34\u51fa\u524d\u7aef\u5f00\u53d1\u65f6\u7684\u90e8\u5206\u4ee3\u7801\u622a\u56fe\uff0c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5b98\u65b9api\u4ecb\u7ecd\u5730\u5740\u662f\uff1a &nbsp;&nbsp;&nbsp;&nbsp;https:\/\/mp.weixin.qq.com\/debug\/wxadoc\/dev\/api\/api-network.html \u5fae\u4fe1\u4e0e\u540e\u53f0\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u6570\u636e\u901a\u4fe1\u662f\u8c03\u7528wx.request(OBJECT)\u5b9e\u73b0\u7684\uff0c\u5b98\u65b9api\u63a5\u53e3\u91cc\u6709\u5bf9\u6b64\u8bf4\u660e\uff0c \u4f8b\u5982\u524d\u53f0\u5411\u540e\u53f0\u53d1\u9001\u6570\u636e\uff0c\u9700\u8981\u94fe\u63a5\u670d\u52a1\u5668php\u4f5c\u7528\u8def\u5f84\u4e0b\u7684\u5177\u4f53php\u6587\u4ef6\uff0c\u5e76\u4ee5key-value\u5f62\u5f0f\u5c01\u88c5json\u683c\u5f0f\u6570\u636e\uff0c\u8bf7\u770b\u4ee5\u4e0b\u4ee3\u7801\uff1a &nbsp;&nbsp;&nbsp;&nbsp; url\u662f\u670d\u52a1\u5668\u7684\u57df\u540d\u53caisbn.php\u5728\u670d\u52a1\u5668\u7684\u4f4d\u7f6e\uff0c\u8fd9\u4e2a\u4f4d\u7f6e\u662f\u76f8\u5bf9\u4f4d\u7f6e\uff0c\u5728\u6211\u4e0a\u4e00\u7bc7\u8d2d\u4e70\u7684\u955c\u50cf\u91cc\u9ed8\u8ba4php\u6587\u4ef6\u8def\u5f84\u4e3a\uff1a &nbsp; &nbsp;\/yjdata\/www\/ &nbsp;\uff0c\u8fd9\u5c31\u610f\u5473\u7740\u76f4\u63a5\u653e\u5728\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e0b\u7684php\u53ea\u9700\u8981\u5728\u57df\u540d\u540e\u76f4\u63a5\/+*.php\u5373\u53ef\uff0c\u5982\u679c\u4e3a\u4e86\u65b9\u4fbf\u7ba1\u7406\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u5efa\u4e86\u4e00\u4e2a\u6587\u4ef6\u5939\u5219\u5728\u57df\u540d\u540e\/\u6587\u4ef6\u5939\u540d\u5b57\/*.php\u5373\u53ef\u3002 &nbsp;&nbsp;&nbsp;&nbsp;\u6b64\u5916\u524d\u7aef\u5411\u540e\u53f0\u4f20\u8f93\u7684\u6570\u636e\u662f\u4ee5json\u683c\u5f0f\u5c01\u88c5\u7684\uff0c\u5982\u56fe\u4e2d\u7684data\u91cc\u5199\u7684\u6570\u636e\uff0c\u524d\u9762\u662fkey\uff0c\u540e\u9762\u662f\u5177\u4f53\u7684value\u503c\uff0c\u540e\u53f0\u53d6\u5f97\u65f6\u5019\u662f\u8981\u6839\u636e\u524d\u9762\u7684key\u503c\u53d6\u503c\uff0c\u6b64\u5916\uff0cmethod\u51b3\u5b9a\u4e86\u540e\u53f0\u4e0e\u524d\u53f0\u901a\u8fc7\u4ec0\u4e48\u65b9\u5f0f\u4ea4\u6d41\uff0c\u8fd9\u91cc\u662f\u7528\u7684GET\u65b9\u6cd5\uff0c\u540e\u53f0\u4e0e\u524d\u53f0\u65b9\u6cd5\u5fc5\u987b\u914d\u5bf9\u4f7f\u7528\uff0c\u4e0d\u80fd\u4e00\u4e2a\u662fGET\uff0c\u53e6\u4e00\u7aef\u662fPOST\uff0c\u5728\u505a\u5fae\u4fe1\u652f\u4ed8\u529f\u80fd\u65f6\uff0c\u6709\u4e9b\u5b89\u5168\u6027\u9690\u79c1\u6027\u8f83\u9ad8\u7684\u6570\u636e\u5fc5\u987b\u91c7\u7528POST\u8fdb\u884c\u4ea4\u4e92\u3002 &nbsp; &nbsp; \u8fd9\u91cc\u7684\u524d\u7aef\u5411\u540e\u53f0\u4f20\u8f93\u7684result\u662f\u56fe\u4e66\u7684ISBN\u7801\uff0c\u56e0\u4e3a\u6211\u4eec\u505a\u7684\u5c0f\u7a0b\u5e8f\u6709\u4e2a\u529f\u80fd\u662f\u8c03\u7528\u76f8\u673a\u626b\u63cf\u4e66\u672c\u540e\u9762\u7684\u6761\u5f62\u7801\u4ece\u800c\u83b7\u5f97ISBN\u7801\uff0c\u524d\u7aef\u5c06ISBN\u7801\u53d1\u9001\u5230\u540e\u53f0\uff0c\u540e\u53f0\u7a0b\u5e8f\u5c06\u8c03\u7528\u7b2c\u4e09\u65b9\u8c46\u74e3\u56fe\u4e66\u63a5\u53e3\u6765\u4f9d\u636eISBN\u7801\u67e5\u8be2\u56fe\u4e66\u4fe1\u606f\uff0c\u5e76\u5c06\u56fe\u4e66\u4fe1\u606f\u8fd4\u56de\u7ed9\u524d\u53f0\uff0c\u8fd9\u91cc\u6211\u8d34\u51fa\u670d\u52a1\u5668\u7aef\u7684\u4ee3\u7801\u4f9b\u5927\u5bb6\u53c2\u8003\uff1a &lt;?php $result=$_GET[&#8220;result&#8221;];\/*\u83b7\u53d6\u524d\u7aef\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u626b\u4e66\u7684isbn\u7ed3\u679c*\/ \u767b\u5f55\u540e\u590d\u5236 \/*\u4e0e\u7b2c\u4e09\u65b9\u63a5\u53e3\u901a\u4fe1\u83b7\u53d6\u4e66\u672c\u4fe1\u606f*\/ \u767b\u5f55\u540e\u590d\u5236 $book_info=file_get_contents(&#8220;https:\/\/api.douban.com\/v2\/book\/isbn\/:&#8221;.$result);$jsondecode&nbsp;=&nbsp;json_decode($book_info,true);\/*\u5c06\u83b7\u53d6\u5230\u7684\u4e66\u672c\u4fe1\u606fJSON\u89e3\u7801*\/$title=$jsondecode[&#8220;title&#8221;];\/*\u5c06\u89e3\u7801\u540e\u4e66\u540d\u8d4b\u503c\u7ed9title\u53d8\u91cf*\/$author=$jsondecode[&#8220;author&#8221;];\/*\u5c06\u89e3\u7801\u540e\u4f5c\u8005\u8d4b\u503c\u7ed9author\u53d8\u91cf*\/$publisher=$jsondecode[&#8220;publisher&#8221;];\/*\u5c06\u89e3\u7801\u540e\u51fa\u7248\u793e\u540d\u8d4b\u503c\u7ed9publisher\u53d8\u91cf*\/echo&nbsp;&#8220;title=&#8221;.$title;&nbsp;\/*\u5411\u524d\u7aef\u8fd4\u56de\u4e66\u540d*\/echo&nbsp;&#8220;author=&#8221;.$author;&nbsp;\/*\u5411\u524d\u7aef\u8fd4\u56de\u4f5c\u8005\u540d*\/echo&nbsp;&#8220;publisher=&#8221;.$publisher;&nbsp;\/*\u5411\u524d\u7aef\u8fd4\u56de\u51fa\u7248\u793e\u540d*\/?&amp;gt; \u767b\u5f55\u540e\u590d\u5236 &nbsp;&nbsp;&nbsp;&nbsp;\u5177\u4f53\u7684\u6ce8\u91ca\u90fd\u5199\u5f97\u5f88\u8be6\u7ec6\uff0c\u5411\u524d\u53f0\u8fd4\u56de\u6570\u636e\u5219\u76f4\u63a5\u7528echo\u5373\u53ef\uff0c\u4e00\u822c\u5f00\u53d1\u90fd\u8981\u4e0e\u6570\u636e\u5e93\u6253\u4ea4\u9053\uff0c\u56e0\u6b64\uff0c\u540e\u53f0\u7a0b\u5e8f\u5c31\u9700\u8981\u4f9d\u636e\u524d\u53f0\u4f20\u6765\u7684\u6570\u636e\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u64cd\u4f5c\uff0c\u8fd9\u4e00\u90e8\u5206\u5176\u5b9e\u4e5f\u5c31\u662f\u63a5\u53d7\u524d\u53f0\u7684\u6570\u636e\uff0c\u6267\u884c\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u8fd9\u4e00\u90e8\u5206\u53ea\u8981\u662f\u8bb2\u5230php\u6570\u636e\u5e93\u64cd\u4f5c\u7684\u90fd\u4f1a\u6709\uff0c\u8fd9\u91cc\u6211\u4e0d\u518d\u8fdb\u884c\u8fc7\u591a\u9610\u8ff0\u3002 &nbsp; &nbsp; \u6b64\u5916\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u6765\u8bf4\uff0c\u56fe\u7247\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u800c\u56fe\u7247\u8d44\u6e90\u90fd\u662f\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e2d\u7684\uff0c\u56e0\u6b64\u5982\u4f55\u5bf9\u56fe\u7247\u8fdb\u884c\u5b58\u50a8\u662f\u4e00\u4e2a\u5173\u952e\u3002\u63a5\u4e0b\u6765\u5c06\u7ed3\u5408\u4e00\u4e2a\u4e66\u672c\u4fe1\u606f\u7684\u5177\u4f53\u63d2\u5165\u6570\u636e\u5e93\u7684\u8fc7\u7a0b\u6765\u8fdb\u884c\u8bb2\u89e3\u3002\u3002\u3002\uff08\u5176\u5b9e\u6ce8\u91ca\u7279\u522b\u8be6\u7ec6\uff09 &lt;?phpheader (&#039;content-type:application\/json;charset=utf8&#039;);$mysql_server_name=&#8221;localhost&#8221;;\/*\u6570\u636e\u5e93\u670d\u52a1\u5668\u540d\u79f0*\/$mysql_username=&#8221;root&#8221;;\/*\u6570\u636e\u5e93\u7528\u6237\u540d*\/$mysql_password=&#8221;123456&#8243;;\/*\u6570\u636e\u5e93\u7528\u6237\u5bc6\u7801*\/$mysql_databasename=&#8221;zhishu&#8221;;\/*\u8fdb\u5165\u6570\u636e\u5e93\u540e\u6570\u636e\u5e93\u540d*\/$conn=mysqli_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_databasename);\/*\u6570\u636e\u5e93\u8fde\u63a5\u8bed\u53e5*\/;;$bookname=$_POST[&#8220;bookname&#8221;];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u540d\u5b57*\/$authorname=$_POST[&#8220;authorname&#8221;];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u4f5c\u8005\u540d\u5b57*\/$bookintroduce=$_POST[&#8220;introduce&#8221;];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u4ecb\u7ecd\u4fe1\u606f*\/$bookholder_name=$_POST[&#8220;openid&#8221;];\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u6301\u6709\u4eba\u6635\u79f0*\/$bookclass=$_POST[&#039;classification&#039;];;\/*\u4ece\u5c0f\u7a0b\u5e8f\u524d\u7aef\u83b7\u53d6\u4e66\u672c\u5206\u7c7b*\/date_default_timezone_set(&#039;PRC&#039;); \/*\u8bbe\u7f6e\u9ed8\u8ba4\u65f6\u533a\u4e3a\u4e2d\u56fd*\/$time=(string)date(&#8220;Y-m-d-h-i&#8221;,time());\/*\u83b7\u53d6\u65f6\u95f4*\/function Unioname($a) \/*\u5c06\u65f6\u95f4\u683c\u5f0f\u66f4\u6539\u7684\u51fd\u6570*\/{ $a=explode(&#039;-&#039;,$a); $a=implode(&#039;&#039;,$a); return $a; }$time=Unioname($time);$allowedExts = array(&#8220;gif&#8221;, &#8220;jpeg&#8221;, &#8220;jpg&#8221;, &#8220;png&#8221;); \/*\u8fd9\u91cc\u7684\u5185\u5bb9\u540c\u7528\u6237\u6ce8\u518c\u65f6\u4ee3\u7801\u542b\u4e49\u4e00\u6837\uff0c\u53ea\u4e0d\u8fc7\u90a3\u65f6\u662f\u4e3a\u4e86\u5b58\u7528\u6237\u5934\u50cf\u5e76\u4fee\u6539\u7528\u6237\u5934\u50cf\u540d\u5b57\uff0c\u8fd9\u91cc\u662f\u5b58\u4e66\u672c\u56fe\u50cf\u5e76\u4fee\u6539\u4e66\u672c\u56fe\u50cf\u7684\u540d\u5b57*\/$temp = explode(&#8220;.&#8221;, $_FILES[&#8220;file&#8221;][&#8220;name&#8221;]);\/\/\u5c06\u56fe\u7247\u540d\u5b57\u4ee5.\u5206\u5272\u6210\u4e24\u4e2a\u5b57\u7b26\u4e32$extension = end($temp); \/\/ \u83b7\u53d6\u56fe\u7247\u540e\u7f00\u540dif ((($_FILES[&#8220;file&#8221;][&#8220;type&#8221;] == &#8220;image\/gif&#8221;) || ($_FILES[&#8220;file&#8221;][&#8220;type&#8221;] == &#8220;image\/jpeg&#8221;) || [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-31446","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=31446"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31446\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}