{"id":857,"date":"2021-03-06T10:35:10","date_gmt":"2021-03-06T02:35:10","guid":{"rendered":"http:\/\/www.tra56.com\/?p=857"},"modified":"2021-03-06T10:35:10","modified_gmt":"2021-03-06T02:35:10","slug":"857","status":"publish","type":"post","link":"https:\/\/www.tra56.com\/857.html","title":{"rendered":"PHP\u5e38\u7528\u51fd\u6570"},"content":{"rendered":"
\/\/PHP\u8bbe\u7f6e\u8de8\u57df\r\nheader("Access-Control-Allow-Origin:*");\r\n\r\n\/\/PHP\u8bbe\u7f6eJSON\u5934 \u4ee5JSON\u683c\u5f0f\u8f93\u51fa\r\nheader("Content-type:application\/json; charset=utf-8");\r\n\r\n\/\/\u6b63\u5219\u53d6\u5b57\u7b26\u4e32\r\npreg_match_all('\/\u5b57\u7b26\u4e32(.*?)\u5b57\u7b26\u4e32\/i',$data,$out);\r\n\r\n\/\/ PHP\u628aJSON\u5bf9\u8c61\u8f6c\u5b57\u7b26\u4e32\u4e0d\u8f6c\u7801\u8f93\u51fa\r\njson_encode($results, JSON_UNESCAPED_UNICODE);\r\n\r\n\/\/PHP\u8bbe\u7f6e\u6700\u5927\u8fd0\u884c\u65f6\u95f4 0 \u662f\u6c38\u4e45\r\nset_time_limit(0);\r\n\r\n\/\/PHP\u8bbe\u7f6e\u6700\u5927\u8fd0\u884c\u5185\u5b58 1024M \u662f1G\r\nini_set('memory_limit', '1024M');\r\n\r\n\/\/\u8fd4\u56de\u6570\u7ec4\u4e2d\u5143\u7d20\u7684\u4e2a\u6570\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a\u8fd4\u56de\u6570\u7ec4\u7684\u957f\u5ea6\r\ncount();\r\n\r\n\/\/\u83b7\u53d6\u53d8\u91cf\u4e2d\u7684\u5b57\u7b26\u4e32\u503c\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a\u628a\u53d8\u91cf\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\u7c7b\u578b\r\nstrval();\r\n\r\n\/\/\u67e5\u8be2\u6570\u7ec4\u91cc\u662f\u5426\u5b58\u5728\u7740\u6307\u5b9a\u7684\u5065\u540d\uff0c\u8fd4\u56detrue\u548cfalse\r\narray_key_exists(\u952e\u540d,\u6570\u7ec4);\r\n\r\n\/\/\u7279\u6b8a\u5b57\u7b26\u8f6c\u6362\uff0c\u53ef\u6709\u6548\u7684\u9632\u6b62xss\u6ce8\u5165\r\nhtmlspecialchars(addslashes(\u53d8\u91cf));\r\n\r\n\/\/\u6e05\u9664\u5b57\u7b26\u4e32\u4e24\u65c1\u7684\u7a7a\u683c\r\ntrim();\r\n\r\n\/\/ \u5411\u6587\u4ef6\u8ffd\u52a0\u5199\u5165\u5185\u5bb9\r\n\/\/ \u4f7f\u7528 FILE_APPEND \u6807\u8bb0\uff0c\u53ef\u4ee5\u5728\u6587\u4ef6\u672b\u5c3e\u8ffd\u52a0\u5185\u5bb9\r\n\/\/ LOCK_EX \u6807\u8bb0\u53ef\u4ee5\u9632\u6b62\u591a\u4eba\u540c\u65f6\u5199\u5165\r\nfile_put_contents(\u6587\u4ef6\u8def\u5f84, \u8981\u5199\u5165\u7684\u5185\u5bb9, FILE_APPEND | LOCK_EX);\r\n\r\n\/\/\u67e5\u8be2\u6570\u7ec4\u91cc\u662f\u5426\u5b58\u5728\u8be5\u952e\u503c\uff0c\u5b58\u5728\u8fd4\u56de\u8be5\u952e\u503c\u7684\u952e\u540d\uff0c\u5982\u679c\u6709\u591a\u4e2a\u5339\u914d\uff0c\u90a3\u4e48\u8fd4\u56de\u6700\u5148\u5339\u914d\u5230\u7684\u952e\u503c\u7684\u952e\u540d\r\n\/\/false\u4ee3\u8868\u4e0d\u9650\u7c7b\u578b\uff0c\u952e\u503c\u6570\u636e\u76f8\u540c\u5373\u53ef\r\n\/\/true\u4ee3\u8868\u5b8c\u5168\u5339\u914d\uff0c\u8981\u6c42\u6570\u636e\u7c7b\u578b\u548c\u952e\u503c\u5b8c\u5168\u76f8\u540c\uff0c\u9ed8\u8ba4\u4e3afalse\r\narray_search("\u952e\u503c", \u6570\u7ec4, false);\r\n\r\n\/\/\u628a\u53d8\u91cf\u8f6c\u6362\u4e3a\u6574\u6570\u7c7b\u578b\uff0c\u5982\u679c\u6709\u5c0f\u6570\uff0c\u5219\u5220\u9664\u5c0f\u6570\uff0c\u4e0d\u6267\u884c\u56db\u820d\u4e94\u5165\r\n\/\/\u5931\u8d25\u6216\u8005\u53d8\u91cf\u4e3a\u7a7a\u65f6\u8fd4\u56de0\uff0c\u5426\u5219\u8fd4\u56de1;\r\nintval();\r\n\r\n\/\/\u5f80\u6570\u7ec4\u5c3e\u90e8\u63d2\u5165\u4e00\u4e2a\u6216\u591a\u4e2a\u5143\u7d20\r\n\/\/\u8fd4\u56de\u65b0\u6570\u7ec4\r\narray_push($a, "\u8981\u63d2\u5165\u7684\u5143\u7d20", "\u8981\u63d2\u5165\u7684\u5143\u7d20");\r\n\r\n\/\/\u628a\u53d8\u91cf\u7c7b\u578b\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\r\n\/\/\u8fd4\u56de\u8be5\u5b57\u7b26\u4e32\r\nstrval();\r\n\r\n\/\/ \u67e5\u8be2\u6570\u7ec4\u91cc\u662f\u5426\u5b58\u5728\u8be5\u952e\u503c\uff0c\u5b58\u5728\u8fd4\u56detrue\uff0c\u53cd\u4e4b\u8fd4\u56defalse\r\n\/\/false\u4ee3\u8868\u4e0d\u9650\u7c7b\u578b\uff0c\u952e\u503c\u6570\u636e\u76f8\u540c\u5373\u53ef\r\n\/\/true\u4ee3\u8868\u5b8c\u5168\u5339\u914d\uff0c\u8981\u6c42\u6570\u636e\u7c7b\u578b\u548c\u952e\u503c\u5b8c\u5168\u76f8\u540c\uff0c\u9ed8\u8ba4\u4e3afalse\r\nin_array('\u952e\u503c', \u6570\u7ec4, false);\r\n\r\n\/\/\u65b0\u5efamysql\u670d\u52a1\u5668\u8fde\u63a5\uff0c\u53ef\u7406\u89e3\u4e3a\u65b0\u5efa\u6570\u636e\u5e93\u8fde\u63a5\r\n$mysql = mysqli_connect("ip", "\u7528\u6237\u540d", "\u5bc6\u7801", "\u6570\u636e\u5e93", "\u7aef\u53e3\uff08\u9ed8\u8ba4\u4e3a3306\uff09");\r\n\r\n\/\/\u4fee\u6539\u6570\u636e\u5e93\u8fde\u63a5\u7684\u5b57\u7b26\u96c6\r\nmysqli_set_charset($mysql, "utf8");\r\n\r\n\/\/\u5bf9\u6570\u636e\u5e93\u8fdb\u884csql\u64cd\u4f5c\r\nmysqli_query($mysql, sql\u8bed\u53e5);\r\n\r\n\/\/\u8fd4\u56de\u7ed3\u679c\u96c6\u7684\u4e2d\u884c\u7684\u6570\u91cf\uff0c\u53ef\u7406\u89e3\u4e3a\u8fd4\u56de\u7ed3\u679c\u96c6\u7684\u957f\u5ea6\r\nmysqli_num_rows();\r\n\r\n\/\/\u4ece\u7ed3\u679c\u96c6\u4e2d\u83b7\u53d6\u4e00\u6761\u6570\u636e\uff0c\u5e76\u4f5c\u4e3a\u6570\u7ec4\u8fd4\u56de\r\nmysqli_fetch_row();\r\n\r\n\/\/\u4ee5\u5207\u5272\u7b26\u4e3a\u65ad\u70b9\u5207\u5272\u5b57\u7b26\u4e32\uff0c\u7ec4\u6210\u6570\u7ec4\u5e76\u8fd4\u56de\uff0c\r\n\/\/\u6570\u7ec4\u7684\u6570\u76ee\u4e5f\u5c31\u662f\u957f\u5ea6\r\n\/\/\u5927\u4e8e0\uff0c\u8fd4\u56de\u76f8\u5bf9\u6570\u503c\u7684\u6570\u7ec4\uff0c\u59821\uff0c\u8fd4\u56de\u7684\u6570\u7ec4\u53ea\u6709\u4e00\u4e2a\u5143\u7d20\uff0c 0\u4e5f\u8fd4\u56de\u53ea\u6709\u4e00\u4e2a\u5143\u7d20\u7684\u6570\u7ec4\r\n\/\/\u5c0f\u4e8e0\uff0c\u4ece\u6570\u7ec4\u5c3e\u90e8\u5f00\u59cb\uff0c\u53bb\u9664 \uff08-x\uff09 \u7684\u7edd\u5bf9\u503c\u4e2a\u5143\u7d20\uff0c\u8fd4\u56de\r\nexplode("\u5206\u5272\u7b26", \u53d8\u91cf, \u8fd4\u56de\u6570\u7ec4\u5143\u7d20\u7684\u6570\u76ee);\r\n\r\n\/\/\u628a\u6570\u7ec4\u91cc\u7684\u5143\u7d20\u6253\u4e71\u968f\u673a\u6392\u5e8f\r\nshuffle();\r\n\r\n\/\/\u622a\u53d6\u4fdd\u7559\u7ed3\u679c\u96c6\u7684\u7b2c n \u6761\u6570\u636e\uff0c\u5176\u4ed6\u5220\u9664\uff0c\u5e76\u8fd4\u56de\r\n\/\/n\u4e3a0\u65f6\u622a\u53d6\u7b2c\u4e00\u6761\uff0c\u4e3a1\u65f6\u622a\u53d6\u7b2c\u4e8c\u6761\uff0c\u4ee5\u6b64\u7c7b\u63a8\uff0cn\u4e3a-1\u65f6\u622a\u53d6\u6700\u540e\u4e00\u6761\r\nmysqli_data_seek($xx, n);\r\n\r\n\/\/\u5c06\u6570\u7ec4\u8f6c\u4e3ajson\u683c\u5f0f\r\njson_encode();\r\n\r\n\/\/\u5c06json\u683c\u5f0f\u8f6c\u4e3a\u6570\u7ec4\u5bf9\u8c61\r\njson_decode($xxx);\r\n\r\n\/\/\u68c0\u6d4b\u53d8\u91cf\u662f\u5426\u4e3a\u6570\u5b57\uff0c\u8fd4\u56de true false\r\nis_numeric(\u53d8\u91cf);\r\n\r\n\/\/\u5c06json\u683c\u5f0f\u8f6c\u4e3a\u6570\u7ec4\r\njson_decode($xxx, true);\r\n\r\n\/\/\u6e05\u9664\u6307\u5b9a\u7684\u53d8\u91cf\r\nunset($a);\r\n\r\n\/\/\u5b57\u7b26\u4e32\u66ff\u6362\u6307\u5b9a\u503c\r\n\/\/\u641c\u7d22$pic\u5b57\u7b26\u4e32\u91cc\u7684\\\u7b26\u53f7\uff0c\u5168\u90e8\u66ff\u6362\u6210\/\r\nstr_replace("\\\\", "\/", $pic);\r\n\r\n\/\/\u8bbe\u7f6e\u65f6\u533a PRC\u4e3a\u4e2d\u56fd\u65f6\u533a\r\ndate_default_timezone_set("PRC");\r\n\r\n\/\/\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\r\ndate('Y-m-d H:i:s', time());\r\n\r\n\/\/\u83b7\u53d6\u5f53\u524d0\u70b9\u7684\u65f6\u95f4\u6233\r\nstrtotime(date("Y-m-d"), time());\r\n\r\n\/\/\u4e0b\u4e2a\u6708\u73b0\u5728\u7684\u65f6\u95f4\u6233\r\nstrtotime('+1 month');\r\n\r\n\/\/\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\u6233\r\ntime();\r\n\r\n\/\/\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\u7684\u5fae\u79d2\r\nmicrotime();\r\n\r\n\/\/\u628a\u65e5\u671f\u65f6\u95f4\u8f6c\u6362\u6210\u65f6\u95f4\u6233\r\nstrtotime();\r\n\/\/\u4f8b\uff1astrtotime("2021-11-21 00:00:00");\r\n\r\n\/\/\u68c0\u67e5\u53d8\u91cf\u662f\u5426\u5b58\u5728\r\nisset();\r\n\r\n\/\/\u68c0\u67e5\u5f53\u524d\u6587\u4ef6\u662f\u5426\u5b58\u5728\r\nfile_exists();\r\n\r\n\/\/\u5ef6\u8fdf\u4e0b\u9762\u7684\u7a0b\u5e8f\u6267\u884c\uff0c1\u4e3a\u5ef6\u8fdf\u4e00\u79d2\u540e\u518d\u6267\u884c\u540e\u9762\u7684\u7a0b\u5e8f\r\nsleep(1);\r\n\r\n\/\/\u521b\u5efa\u76ee\u5f55\uff0c\u5e76\u4e14\u8bbe\u7f6e\u6700\u9ad8\u6743\u9650\r\nmkdir(\u76ee\u5f55\u540d\u79f0, 0700, true);\r\n\r\n\/\/\u521b\u5efa\u4e00\u4e2a0\u5230100\u7684\u968f\u673a\u6570\r\nmt_rand(0, 100);\r\nrand(0,100);\r\n\r\n\/\/\u6839\u636e\u9700\u6c42\u521b\u5efa\u4e00\u4e2a\u6570\u7ec4\u5982\uff1a\r\nrange(0, 100);\r\n\/\/\u7ed3\u679c Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 ... [100] => 100 );\r\n\r\n\/\/\u9996\u5b57\u6bcd\u8f6c\u6362\u4e3a\u5927\u5199\r\nucwords();\r\n\r\n\/\/\u8fd4\u56de\u5f53\u524d\u5185\u5b58\u6d88\u8017\u91cf\r\nmemory_get_usage();\r\n\r\n\/\/\u83b7\u53d6\u4e00\u4e2a\u6570\u7ec4\u7684\u5168\u90e8\u952e\u540d\r\narray_keys(\u6570\u7ec4);\r\n\r\n\/\/\u83b7\u53d6\u4e00\u4e2a\u6570\u7ec4\u7684\u5168\u90e8\u5065\u503c\r\narray_values(\u6570\u7ec4);\r\n\r\n\/\/php\u5f15\u5165php\u6587\u4ef6\r\nrequire()\u3001include()\u3001require_once()\u3001include_once()\r\n\/\/require\u548cinclude\u76f8\u540c\u70b9\uff1a\u90fd\u662f\u5f15\u5165\u5e76\u6267\u884c\u6587\u4ef6\r\n\/\/require\u548cinclude\u4e0d\u540c\u70b9\uff1a\r\n\/\/require\u4e00\u822c\u53ea\u4f1a\u653e\u5728PHP\u811a\u672c\u6700\u524d\u9762\u8fdb\u884c\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5148\u884c\u6267\u884c\u6587\u4ef6\uff0c\u9700\u7b49\u5f85require\u5f15\u5165\u7684\u6587\u4ef6\u6267\u884c\u5b8c\u6210\u65b9\u53ef\u7ee7\u7eed\u6267\u884c\u4e0b\u53bb\uff0c\u5982\u679crequire\u6267\u884c\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u5219\u4f1a\u8fd4\u56de\u4e00\u4e2a\u81f4\u547d\u9519\u8bef\uff0c\u5e76\u5e26\u6389\u7a0b\u5e8f\u3002\r\n\/\/include\u4e00\u822c\u662f\u653e\u5728\u811a\u672c\u4e2d\u95f4\u8fdb\u884c\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u4e0d\u4f1a\u5148\u884c\u6267\u884c\uff0c\u53ea\u4f1a\u5728\u7528\u5230\u7684\u65f6\u5019\u518d\u6267\u884c\u52a0\u8f7d\uff0c\u5982\u679cinclude\u5f15\u5165\u7684\u6587\u4ef6\u6267\u884c\u9519\u8bef\uff0c\u4e0d\u4f1a\u5e26\u6389\u7a0b\u5e8f\uff0c\u53ea\u4f1a\u8fd4\u56de\u4e00\u4e2a\u8b66\u544a\uff0c\u7136\u540e\u7a0b\u5e8f\u7ee7\u7eed\u6267\u884c\u4e0b\u53bb\r\n\/\/\u800crequire_once()\u548cinclude_once()\u5219\u8ddfrequire\u548cinclude\u4e00\u6837\uff0c\u552f\u4e00\u591a\u51fa\u7684\u4e00\u70b9\u5c5e\u6027\u5c31\u662f\uff1a\u68c0\u6d4b\u6587\u4ef6\u662f\u5426\u5df2\u7ecf\u52a0\u8f7d\u8fc7\uff0c\u5982\u679c\u5df2\u7ecf\u52a0\u8f7d\u8fc7\u4e86\uff0c\u5c31\u4e0d\u518d\u8fdb\u884c\u52a0\u8f7d\u4e86\r\n\r\n\/\/\u68c0\u6d4bip\u662f\u5426\u5408\u6cd5\r\nlong2ip()\u548cip2long()\r\n\/\/ip2long()\uff1a\u628aip\u8f6c\u6362\u6210\u4e3a\u6574\u5f62\uff0c\u5982\uff1a2130706433\uff0c\u5982\u679cip\u4e0d\u662f\u5408\u6cd5ip\u5219\u8fd4\u56de\u7a7a\r\n\/\/long2ip()\uff1a\u628a\u6574\u5f62\u8f6c\u6362\u4e3aip\uff0c\u5982\u679c\u6574\u5f62\u4e3a\u7a7a\u5219\u8fd4\u56de0.0.0.0\r\nlong2ip(ip2long("127.0.0.1"));\r\n\r\n\/\/\u6570\u7ec4\u8f6c\u4e3a\u5b57\u7b26\u4e32\r\nimplode(",", \u6570\u7ec4);\r\n\r\n\/\/\u67e5\u770bphp\u8bbe\u7f6e\r\nphpinfo();\r\n\r\npublic\uff08\u516c\u5171\u7684\u3001\u9ed8\u8ba4\uff09\r\n\r\nprotected\uff08\u53d7\u4fdd\u62a4\u7684\uff09\u88ab\u58f0\u660e\u4e3aprotected\u7684\u6210\u5458\uff0c\u53ea\u5141\u8bb8\u8be5\u7c7b\u7684\u5b50\u7c7b\u8fdb\u884c\u8bbf\u95ee\u3002\r\n\r\nprivate\uff08\u79c1\u6709\u7684 \uff09 \u88ab\u5b9a\u4e49\u4e3aprivate\u7684\u6210\u5458\uff0c\u5bf9\u4e8e\u7c7b\u5185\u90e8\u6240\u6709\u6210\u5458\u90fd\u53ef\u89c1\uff0c\u6ca1\u6709\u8bbf\u95ee\u9650\u5236\u3002\u5bf9\u7c7b\u5916\u90e8\u4e0d\u5141\u8bb8\u8bbf\u95ee\u3002\r\n\r\nstatic \u628a\u65b9\u6cd5\u8bbe\u7f6e\u6210\u9759\u6001\u65b9\u6cd5\r\n\r\ninterface \u5b9a\u4e49\u63a5\u53e3 \u5982\r\ninterface a\r\n{\r\n \/\/\u62bd\u8c61\u65b9\u6cd5\uff0c\u91cc\u9762\u4e0d\u6dfb\u52a0\u4efb\u4f55\u6570\u636e\u53ca\u903b\u8f91\r\n public function b();\r\n}\r\n\r\nabstract \u53ef\u628a\u5f53\u524d\u7c7b\u5b9a\u4e49\u4e3a\u62bd\u8c61\u7c7b\uff0c\u62bd\u8c61\u7c7b\u65f6\u4e0d\u80fd\u5b9e\u4f8b\u5316\u7684\uff0c\u7b49\u7740\u88ab\u7ee7\u627f\r\n\r\nimplements \u5b9e\u73b0\u63a5\u53e3\uff0c\u548cextends\u4e0d\u540c\u7684\u662f\uff0c\u5982\u679c\u5f53\u524d\u7c7b\u91cc\u9762\u5b9e\u73b0\u4e86\u8fd9\u4e2a\u63a5\u53e3a\uff0c\u4f46\u662f\u7c7b\u91cc\u9762\u6ca1\u6709\u65b9\u6cd5b\uff0c\u90a3\u4e48\u5c31\u4f1a\u62a5\u9519\r\n\r\nextends \u7ee7\u627f\u7c7b\uff0c\u4f7f\u7528\u8fc7\u6846\u67b6\u7684\u90fd\u77e5\u9053\uff0c\u4ed6\u7684\u4f5c\u7528\u5c31\u662f\u7ee7\u627f\u67d0\u4e2a\u7c7b\uff0c\u4ece\u800c\u8ba9\u4ed6\u66f4\u5bb9\u6613\u7684\u8c03\u7528\u91cc\u9762\u7684\u65b9\u6cd5\r\n\r\nparemt::\u65b9\u6cd5\u540d \u5b50\u7c7b\u8c03\u7528\u7236\u7c7b\u65b9\u6cd5\r\n\r\n\/\/\u68c0\u67e5\u6269\u5c55\u662f\u5426\u5df2\u52a0\u8f7d ,\u8fd4\u56de\u5e03\u5c14\u503c\r\nextension_loaded()\r\n\r\n\/\/\u52a0\u8f7d\u56fe\u7247\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u8fd4\u56de\u503c\u4e3a\u6570\u7ec4\r\ngetimagesize()\r\n\/\/\u8f93\u51fa\u7ed3\u679c\uff1a\r\narray(\r\n \u3000\u3000\u3000\u3000[0]\u3000\u3000\u3000=> \u56fe\u7247\u5bbd\u5ea6\u7684\u50cf\u7d20\u503c\r\n \u3000\u3000\u3000\u3000[1]\u3000\u3000\u3000=> \u56fe\u7247\u9ad8\u5ea6\u7684\u50cf\u7d20\u503c\r\n \u3000\u3000\u3000\u3000[2]\u3000\u3000\u3000=> \u56fe\u7247\u7684\u7c7b\u578b\uff0c\u8fd4\u56de\u7684\u662f\u6570\u5b57\uff0c\u5176\u4e2d1 = GIF\uff0c2 = JPG\uff0c3 = PNG\uff0c4 = SWF\uff0c5 = PSD\uff0c6 = BMP\uff0c7 = TIFF(intel byte order)\uff0c8 = TIFF(motorola byte order)\uff0c9 = JPC\uff0c10 = JP2\uff0c11 = JPX\uff0c12 = JB2\uff0c13 = SWC\uff0c14 = IFF\uff0c15 = WBMP\uff0c16 = XBM\r\n \u3000\u3000\u3000\u3000[3]\u3000\u3000\u3000=> \u56fe\u7247\u7684\u5bbd\u9ad8\r\n \u3000\u3000\u3000\u3000[bits]\u3000=>\u3000\u56fe\u7247\u7684\u6bcf\u79cd\u989c\u8272\u7684\u4f4d\u6570\uff0c\u4e8c\u8fdb\u5236\u683c\u5f0f\r\n \u3000\u3000\u3000\u3000[mime]\u3000=> \u56fe\u7247\u7684 MIME \u4fe1\u606f\uff0c\u6b64\u4fe1\u606f\u53ef\u4ee5\u7528\u6765\u5728 HTTP Content - type \u5934\u4fe1\u606f\u4e2d\u53d1\u9001\u6b63\u786e\u7684\u4fe1\u606f\uff0c\u5982\uff1a header("Content-type: image\/jpeg");\r\n )\r\n\r\n\/\/\u83b7\u53d6\u56fe\u7247\u540e\u7f00 \u6ce8\uff1a\u5f53\u83b7\u53d6\u7684\u56fe\u7247\u540e\u7f00\u4e3ajpg\u7684\u65f6\u5019\uff0c\u5c06\u4f1a\u8f93\u51fajpeg\uff0c\u5f53false\u4e3atrue\u65f6\u5219\u8f93\u51fa.png\r\nimage_type_to_extension(getimagesize('.\/01.png')[2], false);\r\n\r\n\/\/\u521b\u5efa\u753b\u677f,\u9ed8\u8ba4\u80cc\u666f\u989c\u8272\u4e3a\u9ed1\u8272\r\nimagecreatetruecolor(\u5bbd,\u9ad8);\r\n\r\n\/\/\u7ed9\u753b\u677f\u8bbe\u7f6e\u80cc\u666f\u989c\u8272\r\nimagecolorallocate(imagecreatetruecolor(\u5bbd,\u9ad8), 255, 255, 255);\r\n\r\n\/\/\u538b\u7f29\r\nimagecopyresampled(\u753b\u677f,\u56fe\u7247,\u753b\u677fX\u5750\u6807\u70b9,\u753b\u677fy\u5750\u6807\u70b9,\u56fe\u7247x\u5750\u6807\u70b9,\u56fe\u7247y\u5750\u6807\u70b9,\u8981\u538b\u7f29\u5230\u591a\u5bbd,\u8981\u538b\u7f29\u5230\u591a\u9ad8,\u56fe\u7247\u7684\u5bbd,\u56fe\u7247\u7684\u9ad8);\r\n\r\n\/\/\u9500\u6bc1\u56fe\u50cf\u8d44\u6e90\r\nimagedestroy();\r\n\r\n\/\/\u5408\u5e76\u56fe\u7247\uff0c\u628a\u56fe\u72472\u653e\u5230\u56fe\u72471\u91cc\u9762\r\nimagecopymerge(\u56fe\u72471,\u56fe\u72472,\u56fe\u72471x\u5750\u6807\u70b9,\u56fe\u72472y\u5750\u6807\u70b9,\u56fe\u72471x\u5750\u6807\u70b9,\u56fe\u72472y\u5750\u6807\u70b9,\u56fe\u72472\u7684\u5bbd,\u56fe\u72472\u7684\u9ad8,\u900f\u660e\u5ea6);\r\n\r\n\/\/\u8bbe\u7f6e\u5b57\u4f53\u7684\u989c\u8272\r\nimagecolorallocatealpha(\u56fe\u7247\u6216\u8005\u753b\u677f,rgb\u989c\u82721,rgb\u989c\u82722,rgb\u989c\u82723,\u900f\u660e\u5ea6);\r\n\r\n\/\/\u5728\u56fe\u7247\u6216\u8005\u753b\u677f\u91cc\u8bbe\u7f6e\u6c34\u5370\r\nimagettftext(\u753b\u677f\u6216\u8005\u56fe\u7247, \u5b57\u4f53\u5927\u5c0f, \u5b57\u4f53\u503e\u659c\u5ea6, \u5b57\u4f53\u7684x\u5750\u6807, \u5b57\u4f53\u7684y\u5750\u6807, \u5b57\u4f53\u7684\u989c\u8272imagecolorallocatealpha(), \u5b57\u4f53\u6587\u4ef6\u5982\uff1a'STHUPO.TTF', \u8981\u8f93\u51fa\u7684\u6587\u5b57);<\/pre>\n<\/p>\n","protected":false},"excerpt":{"rendered":"
\/\/PHP\u8bbe\u7f6e\u8de8\u57df header("Access-Control-Allow-Origin:*&qu […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[26,72,70],"class_list":["post-857","post","type-post","status-publish","format-standard","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/857"}],"collection":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/comments?post=857"}],"version-history":[{"count":1,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/857\/revisions"}],"predecessor-version":[{"id":858,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/857\/revisions\/858"}],"wp:attachment":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/media?parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/categories?post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/tags?post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}