{"id":936,"date":"2010-03-05T15:19:00","date_gmt":"2010-03-05T07:19:00","guid":{"rendered":""},"modified":"2013-11-26T11:51:35","modified_gmt":"2013-11-26T03:51:35","slug":"%e9%83%a8%e5%88%86php%e9%97%ae%e9%a2%98%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/936.html","title":{"rendered":"\u90e8\u5206PHP\u95ee\u9898\u603b\u7ed3"},"content":{"rendered":"<p>1:\u4e3a\u4ec0\u4e48\u6211\u5f97\u4e0d\u5230\u53d8\u91cf<br \/>\n\u6211\u5728\u4e00\u7f51\u9875\u5411\u53e6\u4e00\u7f51\u9875POST\u6570\u636ename\uff0c\u4e3a\u4ec0\u4e48\u8f93\u51fa$name\u65f6\u5374\u5f97\u4e0d\u5230\u4efb\u4f55\u503c?<br \/>\n\u5728PHP4.2\u4ee5\u540e\u7684\u7248\u672c\u4e2dregister_global\u9ed8\u8ba4\u4e3aoff<br \/>\n\u82e5\u60f3\u53d6\u5f97\u4ece\u53e6\u4e00\u9875\u9762\u63d0\u4ea4\u7684\u53d8\u91cf:<br \/>\n\u65b9\u6cd5\u4e00:\u5728PHP.ini\u4e2d\u627e\u5230register_global\uff0c\u5e76\u628a\u5b83\u8bbe\u7f6e\u4e3aon.<br \/>\n\u65b9\u6cd5\u4e8c:\u5728\u63a5\u6536\u7f51\u9875\u6700\u524d\u9762\u653e\u4e0a\u8fd9\u4e2aextract($_POST);extract($_GET);(\u6ce8\u610fextract($_SESSION)\u524d\u5fc5\u987b\u8981\u6709Session_Start()).<br \/>\n\u65b9\u6cd5\u4e09:\u4e00\u4e2a\u4e00\u4e2a\u8bfb\u53d6\u53d8\u91cf$a=$_GET[&#8220;a&#8221;];$b=$_POST[&#8220;b&#8221;]\u7b49\uff0c\u8fd9\u79cd\u65b9\u6cd5\u867d\u7136\u9ebb\u70e6\uff0c\u4f46\u6bd4\u8f83\u5b89\u5168.<\/p>\n<p>2\uff1a\u8c03\u8bd5\u4f60\u7684\u7a0b\u5e8f<br \/>\n\u5728\u8fd0\u884c\u65f6\u5fc5\u987b\u77e5\u9053\u67d0\u4e2a\u53d8\u91cf\u4e3a\u4f55\u503c\u3002\u6211\u662f\u8fd9\u6837\u505a\u7684\uff0c\u5efa\u7acb\u4e00\u6587\u4ef6debug.php,\u5176\u5185\u5bb9\u5982\u4e0b:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?PHP\r\nOb_Start();\r\nSession_Start();\r\nEcho &quot;&lt;pre&gt;&quot;;\r\nEcho &quot;\u672c\u9875\u5f97\u5230\u7684_GET\u53d8\u91cf\u6709:&quot;;\r\nPrint_R($_GET);\r\nEcho &quot;\u672c\u9875\u5f97\u5230\u7684_POST\u53d8\u91cf\u6709:&quot;;\r\nPrint_R($_POST);\r\nEcho &quot;\u672c\u9875\u5f97\u5230\u7684_COOKIE\u53d8\u91cf\u6709:&quot;;\r\nPrint_R($_COOKIE);\r\nEcho &quot;\u672c\u9875\u5f97\u5230\u7684_SESSION\u53d8\u91cf\u6709:&quot;;\r\nPrint_R($_SESSION);\r\nEcho &quot;&lt;\/pre&gt;&quot;;\r\n?&gt;\r\n<\/pre>\n<p>\u7136\u540e\u5728php.ini\u4e2d\u8bbe\u7f6e\uff1ainclude_path = &#8220;c:\/php&#8221;\uff0c\u5e76\u5c06debug.php\u653e\u5728\u6b64\u6587\u4ef6\u5939,<br \/>\n\u4ee5\u540e\u5c31\u53ef\u4ee5\u5728\u6bcf\u4e2a\u7f51\u9875\u91cc\u5305\u542b\u6b64\u6587\u4ef6\uff0c\u67e5\u770b\u5f97\u5230\u7684\u53d8\u91cf\u540d\u548c\u503c.<\/p>\n<p>3\uff1a\u5982\u4f55\u4f7f\u7528session<br \/>\n\u51e1\u662f\u4e0esession\u6709\u5173\u7684,\u4e4b\u524d\u5fc5\u987b\u8c03\u7528\u51fd\u6570session_start();<br \/>\n\u4e3asession\u4ed8\u503c\u5f88\u7b80\u5355,\u5982:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nSession_start();\r\n$Name = &quot;\u8fd9\u662f\u4e00\u4e2aSession\u4f8b\u5b50&quot;;\r\nSession_Register(&quot;Name&quot;);\/\/\u6ce8\u610f,\u4e0d\u8981\u5199\u6210\uff1aSession_Register(&quot;$Name&quot;);\r\nEcho $_SESSION&#x5B;&quot;Name&quot;];\r\n\/\/\u4e4b\u540e$_SESSION&#x5B;&quot;Name&quot;]\u4e3a&quot;\u8fd9\u662f\u4e00\u4e2aSession\u4f8b\u5b50&quot;\r\n?&gt;\r\n<\/pre>\n<p>\u5728php4.2\u4e4b\u540e,\u53ef\u4ee5\u4e3asession\u76f4\u63a5\u4ed8\u503c:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?PHP\r\nSession_Start();\r\n$_SESSION&#x5B;&quot;name&quot;]=&quot;value&quot;;\r\n?&gt;\r\n<\/pre>\n<p>\u53d6\u6d88session\u53ef\u4ee5\u8fd9\u6837:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nsession_start();\r\nsession_unset();\r\nsession_destroy();\r\n?&gt;\r\n<\/pre>\n<p>\u53d6\u6d88\u67d0\u4e2asession\u53d8\u91cf\u5728php4.2\u4ee5\u4e0a\u8fd8\u6709BUG.<br \/>\n\u6ce8\u610f:<br \/>\n1:\u5728\u8c03\u7528Session_Start()\u4e4b\u524d\u4e0d\u80fd\u6709\u4efb\u4f55\u8f93\u51fa.\u4f8b\u5982\u4e0b\u9762\u662f\u9519\u8bef\u7684.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\r\n &lt;?PHP\r\n Session_Start();\/\/\u4e4b\u524d\u5728\u7b2c\u4e00\u884c\u5df2\u7ecf\u6709\u8f93\u51fa\r\n \u2026..\r\n ?&gt;\r\n<\/pre>\n<p>\u63d0\u793a1:<br \/>\n\u51e1\u662f\u51fa\u73b0&#8221;\u2026\u2026..headers already sent\u2026\u2026\u2026.&#8221;,\u5c31\u662fSession_Start()\u4e4b\u524d\u5411\u6d4f\u89c8\u5668\u8f93\u51fa\u4fe1\u606f.<br \/>\n\u53bb\u6389\u8f93\u51fa\u5c31\u6b63\u5e38,\uff08COOKIE\u4e5f\u4f1a\u51fa\u73b0\u8fd9\u79cd\u9519\u8bef,\u9519\u8bef\u539f\u56e0\u4e00\u6837\uff09<\/p>\n<p>\u63d0\u793a2:<br \/>\n\u5982\u679c\u4f60\u7684Session_Start()\u653e\u5728\u5faa\u73af\u8bed\u53e5\u91cc,\u5e76\u4e14\u5f88\u96be\u786e\u5b9a\u4e4b\u524d\u54ea\u91cc\u5411\u6d4f\u89c8\u5668\u8f93\u51fa\u4fe1\u606f,\u53ef\u4ee5\u7528\u4e0b\u9762\u8fd9\u79cd\u65b9\u6cd5:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n &lt;?PHP Ob_Start(); ?&gt;\r\n\u2026\u2026..\u8fd9\u91cc\u662f\u4f60\u7684\u7a0b\u5e8f\u2026\u2026\r\n<\/pre>\n<p>2:\u8fd9\u662f\u4ec0\u4e48\u9519\u8bef<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nWarning: session_start(): open(\/tmp\\sess_7d190aa36b4c5ec13a5c1649cc2da23f, O_RDWR) failed:\u2026.\r\n<\/pre>\n<p>\u56e0\u4e3a\u4f60\u6ca1\u6709\u6307\u5b9asession\u6587\u4ef6\u7684\u5b58\u653e\u8def\u5f84.<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5:<br \/>\n(1)\u5728c\u76d8\u5efa\u7acb\u6587\u4ef6\u5939tmp<br \/>\n(2)\u6253\u5f00php.ini,\u627e\u5230session.save_path,\u4fee\u6539\u4e3asession.save_path= &#8220;c:\/tmp&#8221;<\/p>\n<p>4:\u4e3a\u4ec0\u4e48\u6211\u5411\u53e6\u4e00\u7f51\u9875\u4f20\u9001\u53d8\u91cf\u65f6,\u53ea\u5f97\u5230\u524d\u534a\u90e8\u5206,\u4ee5\u7a7a\u683c\u5f00\u5934\u7684\u5219\u5168\u90e8\u4e22\u5931<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n$Var=&quot;hello php&quot;;\/\/\u4fee\u6539\u4e3a$Var=&quot; hello php&quot;;\u8bd5\u8bd5\u5f97\u5230\u4ec0\u4e48\u7ed3\u679c\r\n$post= &quot;receive.php?Name=&quot;.$Var;\r\nheader(&quot;location:$post&quot;);\r\n?&gt;\r\n<\/pre>\n<p>receive.php\u7684\u5185\u5bb9:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?PHP\r\nEcho &quot;&lt;pre&gt;&quot;;\r\nEcho $_GET&#x5B;&quot;Name&quot;];\r\nEcho &quot;&lt;\/pre&gt;&quot;;\r\n?&gt;\r\n<\/pre>\n<p>\u6b63\u786e\u7684\u65b9\u6cd5\u662f:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n$Var=&quot;hello php&quot;;\r\n$post= &quot;receive.php?Name=&quot;.urlencode($Var);\r\nheader(&quot;location:$post&quot;);\r\n?&gt;\r\n<\/pre>\n<p>\u5728\u63a5\u6536\u9875\u9762\u4f60\u4e0d\u9700\u8981\u4f7f\u7528Urldecode(),\u53d8\u91cf\u4f1a\u81ea\u52a8\u7f16\u7801.<\/p>\n<p>5:\u5982\u4f55\u622a\u53d6\u6307\u5b9a\u957f\u5ea6\u6c49\u5b57\u800c\u4e0d\u4f1a\u51fa\u73b0\u4ee5&#8221;?&gt;&#8221;\u7ed3\u5c3e,\u8d85\u51fa\u90e8\u5206\u4ee5&#8221;\u2026&#8221;\u4ee3\u66ff<\/p>\n<p>\u4e00\u822c\u6765\u8bf4,\u8981\u622a\u53d6\u7684\u53d8\u91cf\u6765\u81eaMysql,\u9996\u5148\u8981\u4fdd\u8bc1\u90a3\u4e2a\u5b57\u6bb5\u957f\u5ea6\u8981\u8db3\u591f\u957f,\u4e00\u822c\u4e3achar(200),\u53ef\u4ee5\u4fdd\u6301100\u4e2a\u6c49\u5b57\uff0c\u5305\u62ec\u6807\u70b9.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?PHP\r\n$str=&quot;\u8fd9\u4e2a\u5b57\u7b26\u597d\u957f\u5440,^_^&quot;;\r\n$Short_Str=showShort($str,4);\/\/\u622a\u53d6\u524d\u97624\u4e2a\u6c49\u5b57,\u7ed3\u679c\u4e3a:\u8fd9\u4e2a\u5b57\u7b26\u2026\r\nEcho &quot;$Short_Str&quot;;\r\nFunction csubstr($str,$start,$len)\r\n{\r\n$strlen=strlen($str);\r\n$clen=0;\r\nfor($i=0;$i&lt;$strlen;$i++,$clen++)\r\n{\r\nif ($clen&gt;=$start+$len)\r\nbreak;\r\nif(ord(substr($str,$i,1))&gt;0xa0)\r\n{\r\nif ($clen&gt;=$start)\r\n$tmpstr.=substr($str,$i,2);\r\n$i++;\r\n}\r\nelse\r\n{\r\nif ($clen&gt;=$start)\r\n$tmpstr.=substr($str,$i,1);\r\n}\r\n}\r\nreturn $tmpstr;\r\n}\r\nFunction showShort($str,$len)\r\n{\r\n$tempstr = csubstr($str,0,$len);\r\nif ($str&lt;&gt;$tempstr)\r\n$tempstr .= &quot;\u2026&quot;; \/\/\u8981\u4ee5\u4ec0\u4e48\u7ed3\u5c3e,\u4fee\u6539\u8fd9\u91cc\u5c31\u53ef\u4ee5.\r\n\r\nreturn $tempstr;\r\n}\r\n<\/pre>\n<p>6:\u89c4\u8303\u4f60\u7684SQL\u8bed\u53e5<\/p>\n<p>\u5728\u8868\u683c\uff0c\u5b57\u6bb5\u524d\u9762\u52a0\u4e0a&#8221;`&#8221;,\u8fd9\u6837\u5c31\u4e0d\u4f1a\u56e0\u4e3a\u8bef\u7528\u5173\u952e\u5b57\u800c\u51fa\u73b0\u9519\u8bef\uff0c<br \/>\n\u5f53\u7136\u6211\u5e76\u4e0d\u63a8\u8350\u4f60\u4f7f\u7528\u5173\u952e\u5b57.<br \/>\n\u4f8b\u5982<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n$Sql=&quot;INSERT INTO `xltxlm` (`author`, `title`, `id`, `content`, `date`) VALUES (\u2018xltxlm\u2019, \u2018use`\u2019, 1, \u2018criterion your sql string \u2018, \u20192003-07-11 00:00:00\u2032)&quot;\r\n<\/pre>\n<p>&#8220;`&#8221;\u600e\u4e48\u8f93\u5165? \u5728TAB\u952e\u4e0a\u9762.<\/p>\n<p>7:\u5982\u4f55\u4f7fHtml\/PHP\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u4e0d\u88ab\u89e3\u91ca,\u800c\u662f\u7167\u539f\u6837\u663e\u793a<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?PHP\r\n$str=&quot;&lt;h1&gt;PHP&lt;\/h1&gt;&quot;;\r\nEcho &quot;\u88ab\u89e3\u91ca\u8fc7\u7684: &quot;.$str.&quot;&lt;br&gt;\u7ecf\u8fc7\u5904\u7406\u7684:&quot;;\r\nEcho htmlentities(nl2br($str));\r\n?&gt;\r\n<\/pre>\n<p>8:\u600e\u4e48\u5728\u51fd\u6570\u91cc\u53d6\u5f97\u51fd\u6570\u5916\u7684\u53d8\u91cf\u503c<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?PHP\r\n$a=&quot;PHP&quot;;\r\nfoo();\r\nFunction foo()\r\n{\r\nglobal $a;\/\/\u5220\u9664\u8fd9\u91cc\u770b\u770b\u662f\u4ec0\u4e48\u7ed3\u679c\r\nEcho &quot;$a&quot;;\r\n}\r\n?&gt;\r\n<\/pre>\n<p>9:\u6211\u600e\u4e48\u77e5\u9053\u7cfb\u7edf\u9ed8\u8ba4\u652f\u6301\u4ec0\u4e48\u51fd\u6570<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n$arr = get_defined_functions();\r\nFunction php() {\r\n}\r\necho &quot;&lt;pre&gt;&quot;;\r\nEcho &quot;\u8fd9\u91cc\u663e\u793a\u7cfb\u7edf\u6240\u652f\u6301\u7684\u6240\u6709\u51fd\u6570,\u548c\u81ea\u5b9a\u4ee5\u51fd\u6570php\\n&quot;;\r\nprint_r($arr);\r\necho &quot;&lt;\/pre&gt;&quot;;\r\n?&gt;\r\n<\/pre>\n<p>10:\u5982\u4f55\u6bd4\u8f83\u4e24\u4e2a\u65e5\u671f\u76f8\u5dee\u51e0\u5929,(\u66f4\u7b80\u5355\u7684\u7b97\u6cd5)<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?PHP\r\n$Date_1=&quot;2003-7-15&quot;;\/\/\u4e5f\u53ef\u4ee5\u662f:$Date_1=&quot;2003-7-15 23:29:14&quot;;\r\n$Date_2=&quot;1982-10-1&quot;;\r\n$d1=strtotime($Date_1);\r\n$d2=strtotime($Date_2);\r\n$Days=round(($d1-$d2)\/3600\/24);\r\nEcho &quot;\u5076\u5df2\u7ecf\u594b\u6597\u4e86 $Days \u5929^_^&quot;;\r\n?&gt;\r\n<\/pre>\n<p>11:\u4e3a\u4ec0\u4e48\u6211\u5347\u7ea7PHP\u540e,\u539f\u6765\u7684\u7a0b\u5e8f\u51fa\u73b0\u6ee1\u5c4f\u7684 Notice: Undefined variable:<\/p>\n<p>\u8fd9\u662f\u8b66\u544a\u7684\u610f\u601d,\u7531\u4e8e\u53d8\u91cf\u672a\u5b9a\u4e49\u5f15\u8d77\u7684.<br \/>\n\u6253\u5f00php.ini,\u627e\u5230\u6700\u4e0b\u9762\u7684error_reporting,\u4fee\u6539\u4e3aerror_reporting = E_ALL &amp; ~E_NOTICE<br \/>\n\u5bf9\u4e8eParse error\u9519\u8bef<br \/>\nerror_reporting(0)\u65e0\u6cd5\u5173\u95ed.<br \/>\n\u5982\u679c\u4f60\u60f3\u5173\u95ed\u4efb\u4f55\u9519\u8bef\u63d0\u793a,\u6253\u5f00php.ini,\u627e\u5230display_errors,\u8bbe\u7f6e\u4e3adisplay_errors = Off.\u4ee5\u540e\u4efb\u4f55\u9519\u8bef\u90fd\u4e0d\u4f1a\u63d0\u793a.<br \/>\n\u90a3\u4ec0\u4e48\u662ferror_reporting?<\/p>\n<p>12:\u6211\u60f3\u5728\u6bcf\u4e2a\u6587\u4ef6\u6700\u524d\uff0c\u6700\u540e\u9762\u90fd\u52a0\u4e0a\u4e00\u6587\u4ef6.\u4f46\u4e00\u4e2a\u4e00\u4e2a\u6dfb\u52a0\u5f88\u9ebb\u70e6<\/p>\n<p>1:\u6253\u5f00php.ini\u6587\u4ef6<br \/>\n\u8bbe\u7f6e include_path= &#8220;c:&#8221;<br \/>\n2:\u5199\u4e24\u4e2a\u6587\u4ef6<br \/>\nauto_prepend_file.php \u548c auto_append_file.php \u4fdd\u5b58\u5728c\u76d8,\u4ed6\u4eec\u5c06\u81ea\u52a8\u4f9d\u9644\u5728\u6bcf\u4e2aphp\u6587\u4ef6\u7684\u5934\u90e8\u548c\u5c3e\u90e8.<br \/>\n3:\u5728php.ini\u4e2d\u627e\u5230:<br \/>\nAutomatically add files before or after any PHP document.<br \/>\nauto_prepend_file = auto_prepend_file.php;\u4f9d\u9644\u5728\u5934\u90e8<br \/>\nauto_append_file = auto_append_file.php;\u4f9d\u9644\u5728\u5c3e\u90e8<br \/>\n\u4ee5\u540e\u4f60\u6bcf\u4e2aphp\u6587\u4ef6\u5c31\u76f8\u5f53\u4e8e<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nInclude &quot;auto_prepend_file.php&quot; ;\r\n\u2026\u2026.\/\/\u8fd9\u91cc\u662f\u4f60\u7684\u7a0b\u5e8f\r\n\r\nInclude &quot;auto_append_file.php&quot;;\r\n?&gt;\r\n<\/pre>\n<p>13:\u5982\u4f55\u5229\u7528PHP\u4e0a\u4f20\u6587\u4ef6<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;html&gt;&lt;head&gt;\r\n&lt;title&gt;\u4e0a\u8f7d\u6587\u4ef6\u8868\u5355&lt;\/title&gt;&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;form enctype=&quot;multipart\/form-data&quot; action=&quot;&quot; method=&quot;post&quot;&gt;\r\n\u8bf7\u9009\u62e9\u6587\u4ef6\uff1a &lt;br&gt;\r\n&lt;input name=&quot;upload_file&quot; type=&quot;file&quot;&gt;&lt;br&gt;\r\n&lt;input type=&quot;submit&quot; value=&quot;\u4e0a\u4f20\u6587\u4ef6&quot;&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n&lt;?\r\n$upload_file=$_FILES&#x5B;'upload_file']&#x5B;'tmp_name'];\r\n$upload_file_name=$_FILES&#x5B;'upload_file']&#x5B;'name'];\r\n\r\nif($upload_file){\r\n$file_size_max = 1000*1000;\/\/ 1M\u9650\u5236\u6587\u4ef6\u4e0a\u4f20\u6700\u5927\u5bb9\u91cf(bytes)\r\n$store_dir = &quot;d:\/&quot;;\/\/ \u4e0a\u4f20\u6587\u4ef6\u7684\u50a8\u5b58\u4f4d\u7f6e\r\n$accept_overwrite = 1;\/\/\u662f\u5426\u5141\u8bb8\u8986\u76d6\u76f8\u540c\u6587\u4ef6\r\n\/\/ \u68c0\u67e5\u6587\u4ef6\u5927\u5c0f\r\nif ($upload_file_size &gt; $file_size_max) {\r\necho &quot;\u5bf9\u4e0d\u8d77\uff0c\u4f60\u7684\u6587\u4ef6\u5bb9\u91cf\u5927\u4e8e\u89c4\u5b9a&quot;;\r\nexit;\r\n}\r\n\/\/ \u68c0\u67e5\u8bfb\u5199\u6587\u4ef6\r\nif (file_exists($store_dir . $upload_file_name) &amp;&amp; !$accept_overwrite) {\r\nEcho &quot;\u5b58\u5728\u76f8\u540c\u6587\u4ef6\u540d\u7684\u6587\u4ef6&quot;;\r\nexit;\r\n}\r\n\/\/\u590d\u5236\u6587\u4ef6\u5230\u6307\u5b9a\u76ee\u5f55\r\nif (!move_uploaded_file($upload_file,$store_dir.$upload_file_name)) {\r\necho &quot;\u590d\u5236\u6587\u4ef6\u5931\u8d25&quot;;\r\nexit;\r\n}\r\n}\r\nEcho &quot;&lt;p&gt;\u4f60\u4e0a\u4f20\u4e86\u6587\u4ef6:&quot;;\r\necho $_FILES&#x5B;'upload_file']&#x5B;'name'];\r\necho &quot;&lt;br&gt;&quot;;\r\n\/\/\u5ba2\u6237\u7aef\u673a\u5668\u6587\u4ef6\u7684\u539f\u540d\u79f0\u3002\r\nEcho &quot;\u6587\u4ef6\u7684 MIME \u7c7b\u578b\u4e3a:&quot;;\r\necho $_FILES&#x5B;'upload_file']&#x5B;'type'];\r\n\/\/\u6587\u4ef6\u7684 MIME \u7c7b\u578b\uff0c\u9700\u8981\u6d4f\u89c8\u5668\u63d0\u4f9b\u8be5\u4fe1\u606f\u7684\u652f\u6301\uff0c\u4f8b\u5982\u201cimage\/gif\u201d\u3002\r\necho &quot;&lt;br&gt;&quot;;\r\nEcho &quot;\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f:&quot;;\r\necho $_FILES&#x5B;'upload_file']&#x5B;'size'];\r\n\/\/\u5df2\u4e0a\u4f20\u6587\u4ef6\u7684\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5b57\u8282\u3002\r\necho &quot;&lt;br&gt;&quot;;\r\nEcho &quot;\u6587\u4ef6\u4e0a\u4f20\u540e\u88ab\u4e34\u65f6\u50a8\u5b58\u4e3a:&quot;;\r\necho $_FILES&#x5B;'upload_file']&#x5B;'tmp_name'];\r\n\/\/\u6587\u4ef6\u88ab\u4e0a\u4f20\u540e\u5728\u670d\u52a1\u7aef\u50a8\u5b58\u7684\u4e34\u65f6\u6587\u4ef6\u540d\u3002\r\necho &quot;&lt;br&gt;&quot;;\r\n$Erroe=$_FILES&#x5B;'upload_file']&#x5B;'error'];\r\nswitch($Erroe){\r\ncase 0:\r\nEcho &quot;\u4e0a\u4f20\u6210\u529f&quot;; break;\r\ncase 1:\r\nEcho &quot;\u4e0a\u4f20\u7684\u6587\u4ef6\u8d85\u8fc7\u4e86 php.ini \u4e2d upload_max_filesize \u9009\u9879\u9650\u5236\u7684\u503c.&quot;; break;\r\ncase 2:\r\nEcho &quot;\u4e0a\u4f20\u6587\u4ef6\u7684\u5927\u5c0f\u8d85\u8fc7\u4e86 HTML \u8868\u5355\u4e2d MAX_FILE_SIZE \u9009\u9879\u6307\u5b9a\u7684\u503c\u3002&quot;; break;\r\ncase 3:\r\nEcho &quot;\u6587\u4ef6\u53ea\u6709\u90e8\u5206\u88ab\u4e0a\u4f20&quot;;break;\r\ncase 4:\r\nEcho &quot;\u6ca1\u6709\u6587\u4ef6\u88ab\u4e0a\u4f20&quot;;break;\r\n}\r\n?&gt;\r\n<\/pre>\n<p>14:\u5982\u4f55\u914d\u7f6eGD\u5e93<\/p>\n<p>\u4e0b\u9762\u662f\u6211\u7684\u914d\u7f6e\u8fc7\u7a0b<br \/>\n1:\u7528dos\u547d\u4ee4(\u4e5f\u53ef\u4ee5\u624b\u52a8\u64cd\u4f5c,\u62f7\u8d1ddlls\u6587\u4ef6\u5939\u91cc\u6240\u6709dll\u6587\u4ef6\u5230system32\u76ee\u5f55\u4e0b) copy c:\\php\\dlls\\*.dll c:\\windows\\system32\\<br \/>\n2:\u6253\u5f00php.ini<br \/>\n\u8bbe\u7f6eextension_dir = &#8220;c:\/php\/extensions\/&#8221;;<br \/>\n3:extension=php_gd2.dll;\u628aextension\u524d\u9762\u7684\u9017\u53f7\u53bb\u6389\uff0c\u5982\u679c\u6ca1\u6709php_gd2.dll\uff0cphp_gd.dll\u4e5f\u4e00\u6837,\u4fdd\u8bc1\u786e\u5b9e\u5b58\u5728\u8fd9\u4e00\u6587\u4ef6c:\/php\/extensions\/php_gd2.dll<br \/>\n4:\u8fd0\u884c\u4e0b\u9762\u7a0b\u5e8f\u8fdb\u884c\u6d4b\u8bd5<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nOb_end_flush();\r\n\/\/\u6ce8\u610f,\u5728\u6b64\u4e4b\u524d\u4e0d\u80fd\u5411\u6d4f\u89c8\u5668\u8f93\u51fa\u4efb\u4f55\u4fe1\u606f,\u8981\u6ce8\u610f\u662f\u5426\u8bbe\u7f6e\u4e86 auto_prepend_file.\r\nheader (&quot;Content-type: image\/png&quot;);\r\n$im = @imagecreate (200, 100)\r\nor die (&quot;\u65e0\u6cd5\u521b\u5efa\u56fe\u50cf&quot;);\r\n$background_color = imagecolorallocate ($im, 0,0, 0);\r\n$text_color = imagecolorallocate ($im, 230, 140, 150);\r\nimagestring ($im, 3, 30, 50, &quot;A Simple Text String&quot;, $text_color);\r\nimagepng ($im);\r\n?&gt;\r\n<\/pre>\n<p>15:\u4ec0\u4e48\u662fUBB\u4ee3\u7801<\/p>\n<p>UBB\u4ee3\u7801\u662fHTML\u7684\u4e00\u4e2a\u53d8\u79cd,\u662fUltimate Bulletin Board (\u56fd\u5916\u4e00\u4e2aBBS\u7a0b\u5e8f\uff0c\u56fd\u5185\u4e5f\u6709\u4e0d\u5c11\u5730\u65b9\u4f7f\u7528\u8fd9\u4e2a\u7a0b\u5e8f)\u91c7\u7528\u7684\u4e00\u79cd\u7279\u6b8a\u7684TAG.<br \/>\n\u5373\u4f7f\u7981\u6b62\u4f7f\u7528 HTML\uff0c\u4f60\u4e5f\u53ef\u4ee5\u7528 UBBCode? \u6765\u5b9e\u73b0.\u4e5f\u8bb8\u4f60\u66f4\u5e0c\u671b\u4f7f\u7528 UBBCode? \u800c\u4e0d\u662f HTML, \u5373\u4f7f\u8bba\u575b\u5141\u8bb8\u4f7f\u7528 HTML, \u56e0\u4e3a\u4f7f\u7528\u8d77\u6765\u4ee3\u7801\u8f83\u5c11\u4e5f\u66f4\u5b89\u5168.<br \/>\nQ3boy\u7684UBB\u91cc\u9762\u4ed8\u6709\u4f8b\u5b50,\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u6d4b\u8bd5<\/p>\n<p>16:\u6211\u60f3\u4fee\u6539MySQL\u7684\u7528\u6237,\u5bc6\u7801<\/p>\n<p>\u9996\u5148\u8981\u58f0\u660e\u4e00\u70b9\uff0c\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\uff0c\u4fee\u6539MySQL\u662f\u9700\u8981\u6709mysql\u91cc\u7684root\u6743\u9650\u7684\uff0c<br \/>\n\u6240\u4ee5\u4e00\u822c\u7528\u6237\u65e0\u6cd5\u66f4\u6539\u5bc6\u7801\uff0c\u9664\u975e\u8bf7\u6c42\u7ba1\u7406\u5458.<br \/>\n\u65b9\u6cd5\u4e00<br \/>\n\u4f7f\u7528phpmyadmin\uff0c\u8fd9\u662f\u6700\u7b80\u5355\u7684\u4e86\uff0c\u4fee\u6539mysql\u5e93\u7684user\u8868\uff0c<br \/>\n\u4e0d\u8fc7\u522b\u5fd8\u4e86\u4f7f\u7528PASSWORD\u51fd\u6570\u3002<br \/>\n\u65b9\u6cd5\u4e8c<br \/>\n\u4f7f\u7528mysqladmin\uff0c\u8fd9\u662f\u524d\u9762\u58f0\u660e\u7684\u4e00\u4e2a\u7279\u4f8b\u3002<br \/>\nmysqladmin -u root -p password mypasswd<br \/>\n\u8f93\u5165\u8fd9\u4e2a\u547d\u4ee4\u540e\uff0c\u9700\u8981\u8f93\u5165root\u7684\u539f\u5bc6\u7801\uff0c\u7136\u540eroot\u7684\u5bc6\u7801\u5c06\u6539\u4e3amypasswd\u3002<br \/>\n\u628a\u547d\u4ee4\u91cc\u7684root\u6539\u4e3a\u4f60\u7684\u7528\u6237\u540d\uff0c\u4f60\u5c31\u53ef\u4ee5\u6539\u4f60\u81ea\u5df1\u7684\u5bc6\u7801\u4e86\u3002<br \/>\n\u5f53\u7136\u5982\u679c\u4f60\u7684mysqladmin\u8fde\u63a5\u4e0d\u4e0amysql server\uff0c\u6216\u8005\u4f60\u6ca1\u6709\u529e\u6cd5\u6267\u884cmysqladmin\uff0c<br \/>\n\u90a3\u4e48\u8fd9\u79cd\u65b9\u6cd5\u5c31\u662f\u65e0\u6548\u7684\u3002<br \/>\n\u800c\u4e14mysqladmin\u65e0\u6cd5\u628a\u5bc6\u7801\u6e05\u7a7a\u3002<br \/>\n\u4e0b\u9762\u7684\u65b9\u6cd5\u90fd\u5728mysql\u63d0\u793a\u7b26\u4e0b\u4f7f\u7528\uff0c\u4e14\u5fc5\u987b\u6709mysql\u7684root\u6743\u9650\uff1a<br \/>\n\u65b9\u6cd5\u4e09<br \/>\nmysql&gt; INSERT INTO mysql.user (Host,User,Password)<br \/>\nVALUES(\u2018%\u2019,&#8217;jeffrey\u2019,PASSWORD(\u2018biscuit\u2019));<br \/>\nmysql&gt; FLUSH PRIVILEGES<br \/>\n\u786e\u5207\u5730\u8bf4\u8fd9\u662f\u5728\u589e\u52a0\u4e00\u4e2a\u7528\u6237\uff0c\u7528\u6237\u540d\u4e3ajeffrey\uff0c\u5bc6\u7801\u4e3abiscuit\u3002<br \/>\n\u5728\u300amysql\u4e2d\u6587\u53c2\u8003\u624b\u518c\u300b\u91cc\u6709\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u6240\u4ee5\u6211\u4e5f\u5c31\u5199\u51fa\u6765\u4e86\u3002<br \/>\n\u6ce8\u610f\u8981\u4f7f\u7528PASSWORD\u51fd\u6570\uff0c\u7136\u540e\u8fd8\u8981\u4f7f\u7528FLUSH PRIVILEGES\u3002<br \/>\n\u65b9\u6cd5\u56db<br \/>\n\u548c\u65b9\u6cd5\u4e09\u4e00\u6837\uff0c\u53ea\u662f\u4f7f\u7528\u4e86REPLACE\u8bed\u53e5<br \/>\nmysql&gt; REPLACE INTO mysql.user (Host,User,Password)<br \/>\nVALUES(\u2018%\u2019,&#8217;jeffrey\u2019,PASSWORD(\u2018biscuit\u2019));<br \/>\nmysql&gt; FLUSH PRIVILEGES<br \/>\n\u65b9\u6cd5\u4e94<br \/>\n\u4f7f\u7528SET PASSWORD\u8bed\u53e5\uff0c<br \/>\nmysql&gt; SET PASSWORD FOR jeffrey@&#8221;%&#8221; = PASSWORD(\u2018biscuit\u2019);<br \/>\n\u4f60\u4e5f\u5fc5\u987b\u4f7f\u7528PASSWORD()\u51fd\u6570\uff0c<br \/>\n\u4f46\u662f\u4e0d\u9700\u8981\u4f7f\u7528FLUSH PRIVILEGES\u3002<br \/>\n\u65b9\u6cd5\u516d<br \/>\n\u4f7f\u7528GRANT \u2026 IDENTIFIED BY\u8bed\u53e5<br \/>\nmysql&gt; GRANT USAGE ON *.* TO jeffrey@&#8221;%&#8221; IDENTIFIED BY \u2018biscuit\u2019;<br \/>\n\u8fd9\u91ccPASSWORD()\u51fd\u6570\u662f\u4e0d\u5fc5\u8981\u7684\uff0c\u4e5f\u4e0d\u9700\u8981\u4f7f\u7528FLUSH PRIVILEGES\u3002<br \/>\n\u6ce8\u610f\uff1a PASSWORD() [\u4e0d\u662f]\u4ee5\u5728Unix\u53e3\u4ee4\u52a0\u5bc6\u7684\u540c\u6837\u65b9\u6cd5\u65bd\u884c\u53e3\u4ee4\u52a0\u5bc6\u3002<\/p>\n<p>17:\u6211\u60f3\u77e5\u9053\u4ed6\u662f\u901a\u8fc7\u54ea\u4e2a\u7f51\u7ad9\u8fde\u63a5\u5230\u672c\u9875<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\/\/\u5fc5\u987b\u901a\u8fc7\u8d85\u7ea7\u8fde\u63a5\u8fdb\u5165\u624d\u6709\u8f93\u51fa\r\nEcho $_SERVER&#x5B;'HTTP_REFERER'];\r\n?&gt;\r\n<\/pre>\n<p>18:\u6570\u636e\u653e\u5165\u6570\u636e\u5e93\u548c\u53d6\u51fa\u6765\u663e\u793a\u5728\u9875\u9762\u9700\u8981\u6ce8\u610f\u4ec0\u4e48<\/p>\n<p>\u5165\u5e93\u65f6<br \/>\n$str=addslashes($str);<br \/>\n$sql=&#8221;insert into `tab` (`content`) values(\u2018$str\u2019)&#8221;;<br \/>\n\u51fa\u5e93\u65f6<br \/>\n$str=stripslashes($str);<br \/>\n\u663e\u793a\u65f6<br \/>\n$str=htmlspecialchars(nl2br($str)) ;<\/p>\n<p>19:\u5982\u4f55\u8bfb\u53d6\u5f53\u524d\u5730\u5740\u680f\u4fe1\u606f<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n$s=&quot;http:\/\/{$_SERVER&#x5B;'HTTP_HOST']}:{$_SERVER&#x5B;&quot;SERVER_PORT&quot;]}{$_SERVER&#x5B;'SCRIPT_NAME']}&quot;;\r\n$se=\u201d;\r\nforeach ($_GET as $key =&gt; $value) {\r\n$se.=$key.&quot;=&quot;.$value.&quot;&amp;&quot;;\r\n}\r\n$se=Preg_Replace(&quot;\/(.*)&amp;$\/&quot;,&quot;$1&quot;,$se);\r\n$se?$se=&quot;?&quot;.$se:&quot;&quot;;\r\necho $s.&quot;?$se&quot;;\r\n?&gt;\r\n<\/pre>\n<p>20:\u6211\u70b9\u51fb\u540e\u9000\u6309\u94ae,\u4e3a\u4ec0\u4e48\u4e4b\u524d\u586b\u5199\u7684\u4e1c\u897f\u4e0d\u89c1<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3a\u4f60\u4f7f\u7528\u4e86session.<br \/>\n\u89e3\u51b3\u529e\u6cd5:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nsession_cache_limiter(\u2018private, must-revalidate\u2019);\r\nsession_start();\r\n\u2026\u2026\u2026..\r\n\u2026\u2026\u2026.\r\n?&gt;\r\n<\/pre>\n<p>21:\u600e\u4e48\u5728\u56fe\u7247\u91cc\u663e\u793aIP\u5730\u5740<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?\r\nHeader(&quot;Content-type: image\/png&quot;);\r\n$img = ImageCreate(180,50);\r\n$ip = $_SERVER&#x5B;'REMOTE_ADDR'];\r\nImageColorTransparent($img,$bgcolor);\r\n$bgColor = ImageColorAllocate($img, 0x2c,0x6D,0xAF); \/\/ \u80cc\u666f\u989c\u8272\r\n$shadow = ImageColorAllocate($img, 250,0,0); \/\/ \u9634\u5f71\u989c\u8272\r\n$textColor = ImageColorAllocate($img, oxff,oxff,oxff); \/\/ \u5b57\u4f53\u989c\u8272\r\nImageTTFText($img,10,0,78,30,$shadow,&quot;d:\/windows\/fonts\/Tahoma.ttf&quot;,$ip); \/\/\u663e\u793a\u80cc\u666f\r\nImageTTFText($img,10,0,25,28,$textColor,&quot;d:\/windows\/fonts\/Tahoma.ttf&quot;,&quot;your ip is&quot;.$ip); \/\/ \u663e\u793aIP\r\nImagePng($img);\r\nimagecreatefrompng($img);\r\nImageDestroy($img);\r\n?&gt;\r\n<\/pre>\n<p>22:\u5982\u4f55\u53d6\u5f97\u7528\u6237\u7684\u771f\u5b9eIP<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?\r\nfunction iptype1 () {\r\nif (getenv(&quot;HTTP_CLIENT_IP&quot;)) {\r\nreturn getenv(&quot;HTTP_CLIENT_IP&quot;);\r\n}\r\nelse {\r\nreturn &quot;none&quot;;\r\n}\r\n}\r\nfunction iptype2 () {\r\nif (getenv(&quot;HTTP_X_FORWARDED_FOR&quot;)) {\r\nreturn getenv(&quot;HTTP_X_FORWARDED_FOR&quot;);\r\n}\r\nelse {\r\nreturn &quot;none&quot;;\r\n}\r\n}\r\nfunction iptype3 () {\r\nif (getenv(&quot;REMOTE_ADDR&quot;)) {\r\nreturn getenv(&quot;REMOTE_ADDR&quot;);\r\n}\r\nelse {\r\nreturn &quot;none&quot;;\r\n}\r\n}\r\nfunction ip() {\r\n$ip1 = iptype1();\r\n$ip2 = iptype2();\r\n$ip3 = iptype3();\r\nif (isset($ip1) &amp;&amp; $ip1 != &quot;none&quot; &amp;&amp; $ip1 != &quot;unknown&quot;) {\r\nreturn $ip1;\r\n}\r\nelseif (isset($ip2) &amp;&amp; $ip2 != &quot;none&quot; &amp;&amp; $ip2 != &quot;unknown&quot;) {\r\nreturn $ip2;\r\n}\r\nelseif (isset($ip3) &amp;&amp; $ip3 != &quot;none&quot; &amp;&amp; $ip3 != &quot;unknown&quot;) {\r\nreturn $ip3;\r\n}\r\nelse {\r\nreturn &quot;none&quot;;\r\n}\r\n}\r\nEcho ip();\r\n?&gt;\r\n<\/pre>\n<p>23:\u5982\u4f55\u4ece\u6570\u636e\u5e93\u8bfb\u53d6\u4e09\u5929\u5185\u7684\u6240\u6709\u8bb0\u5f55<\/p>\n<p>\u9996\u5148\u8868\u683c\u91cc\u8981\u6709\u4e00\u4e2aDATETIME\u5b57\u6bb5\u8bb0\u5f55\u65f6\u95f4,<br \/>\n\u683c\u5f0f\u4e3a\u20192003-7-15 16:50:00\u2032<br \/>\nSELECT * FROM `xltxlm` WHERE TO_DAYS(NOW()) \u2013 TO_DAYS(`date`)<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\"> &lt;?php \/\/\u9996\u5148\u4f60\u8981\u6709\u8bfb\u5199\u6587\u4ef6\u7684\u6743\u9650 \/\/\u672c\u7a0b\u5e8f\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c,\u7b2c\u4e00\u6b21\u62a5\u9519,\u4ee5\u540e\u5c31\u53ef\u4ee5 $online_log = &quot;count.dat&quot;; \/\/\u4fdd\u5b58\u4eba\u6570\u7684\u6587\u4ef6, $timeout = 30;\/\/30\u79d2\u5185\u6ca1\u52a8\u4f5c\u8005,\u8ba4\u4e3a\u6389\u7ebf $entries = file($online_log); $temp = array(); for ($i=0;$i&lt;count($entries);$i++) { $entry = explode(&quot;,&quot;,trim($entries&#x5B;$i])); if (($entry&#x5B;0] != getenv(\u2018REMOTE_ADDR\u2019)) &amp;&amp; ($entry&#x5B;1] &gt; time())) { array_push($temp,$entry&#x5B;0].&quot;,&quot;.$entry&#x5B;1].&quot;\\n&quot;); \/\/\u53d6\u51fa\u5176\u4ed6\u6d4f\u89c8\u8005\u7684\u4fe1\u606f,\u5e76\u53bb\u6389\u8d85\u65f6\u8005,\u4fdd\u5b58\u8fdb$temp } } array_push($temp,getenv(\u2018REMOTE_ADDR\u2019).&quot;,&quot;.(time() + ($timeout)).&quot;\\n&quot;); \/\/\u66f4\u65b0\u6d4f\u89c8\u8005\u7684\u65f6\u95f4 $users_online = count($temp); \/\/\u8ba1\u7b97\u5728\u7ebf\u4eba\u6570 $entries = implode(&quot;&quot;,$temp); \/\/\u5199\u5165\u6587\u4ef6 $fp = fopen($online_log,&quot;w&quot;); flock($fp,LOCK_EX); \/\/flock() \u4e0d\u80fd\u5728NFS\u4ee5\u53ca\u5176\u4ed6\u7684\u4e00\u4e9b\u7f51\u7edc\u6587\u4ef6\u7cfb\u7edf\u4e2d\u6b63\u5e38\u5de5\u4f5c fputs($fp,$entries); flock($fp,LOCK_UN); fclose($fp); echo &quot;\u5f53\u524d\u6709&quot;.$users_online.&quot;\u4eba\u5728\u7ebf&quot;; ?&gt; <\/pre>\n<p>\u4f8b\u5b50\u4e8c: \u7528\u6570\u636e\u5e93\u5b9e\u73b0\u5728\u7ebf\u7528\u6237 30:\u4ec0\u4e48\u662f\u6a21\u677f,\u600e\u4e48\u7528 \u8fd9\u91cc\u6709\u51e0\u7bc7\u5173\u4e8e\u6a21\u677f\u7684\u6587\u7ae0 \u6211\u7528\u7684\u662fphplib\u6a21\u677f \u4e0b\u9762\u662f\u5176\u4e2d\u51e0\u4e2a\u51fd\u6570\u7684\u4f7f\u7528 $T-&gt;Set_File(&#8220;\u968f\u4fbf\u5b9a\u4e49&#8221;,&#8221;\u6a21\u677f\u6587\u4ef6.tpl&#8221;);<br \/>\n$T-&gt;Set_Block(&#8220;\u5728set_file\u4e2d\u5b9a\u4e49\u7684&#8221;,&#8221;&#8221;,&#8221;\u968f\u4fbf\u5b9a\u4e49&#8221;);<br \/>\n$T-&gt;Parse(&#8220;\u5728Set_Block\u4e2d\u5b9a\u4e49\u7684&#8221;,&#8221;&#8221;,true);<br \/>\n$T-&gt;Parse(&#8220;\u968f\u4fbf\u8f93\u51fa\u7ed3\u679c&#8221;,&#8221;\u5728Set_File\u4e2d\u5b9a\u4e49\u7684&#8221;);<br \/>\n\u8bbe\u7f6e\u5faa\u73af\u683c\u5f0f\u4e3a:<\/p>\n<p>\u5982\u4f55\u5c06\u6a21\u677f\u751f\u6210\u9759\u6001\u7f51\u9875<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\/\/\u8fd9\u91cc\u4f7f\u7528phplib\u6a21\u677f\r\n\u2026\u2026\u2026\u2026\r\n\u2026\u2026\u2026\u2026\r\n$tpl-&gt;parse(&quot;output&quot;,&quot;html&quot;);\r\n$output = $tpl-&gt;get(&quot;output&quot;);\/\/ $output \u4e3a\u6574\u4e2a\u7f51\u9875\u5185\u5bb9\r\n\r\nfunction wfile($file,$content,$mode=\u2019w') {\r\n$oldmask = umask(0);\r\n$fp = fopen($file, $mode);\r\nif (!$fp) return false;\r\nfwrite($fp,$content);\r\nfclose($fp);\r\numask($oldmask);\r\nreturn true;\r\n}\r\n\/\/ \u5199\u5230\u6587\u4ef6\u91cc\r\nWfile($FILE,$output);\r\nheader(&quot;location:$FILE&quot;);\/\/\u91cd\u5b9a\u5411\u5230\u751f\u6210\u7684\u7f51\u9875\r\n}\r\n?&gt;\r\n<\/pre>\n<p>31:\u600e\u4e48\u7528php\u89e3\u91ca\u5b57\u7b26<\/p>\n<p>\u6bd4\u5982:\u8f93\u51652+2*(1+2),\u81ea\u52a8\u8f93\u51fa8<br \/>\n\u53ef\u4ee5\u7528eval\u51fd\u6570<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;form method=post action=&quot;&quot;&gt;\r\n&lt;input type=&quot;text&quot; name=&quot;str&quot;&gt;&lt;input type=&quot;submit&quot;&gt;\r\n&lt;\/form&gt;\r\n&lt;?php\r\n$str=$_POST&#x5B;'str'];\r\neval(&quot;\\$o=$str;&quot;);\r\nEcho &quot;$o&quot;;\r\n?&gt;\r\n<\/pre>\n<p>\u53e6\u5916,\u7528\u6b64\u51fd\u6570\u5fc5\u987b\u7279\u522b\u5c0f\u5fc3!!<br \/>\n\u5982\u679c\u6709\u4eba\u8f93\u5165format: d:\u4f1a\u662f\u4ec0\u4e48\u7ed3\u679c?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1:\u4e3a\u4ec0\u4e48\u6211\u5f97\u4e0d\u5230\u53d8\u91cf \u6211\u5728\u4e00\u7f51\u9875\u5411\u53e6\u4e00\u7f51\u9875POST\u6570\u636ename\uff0c\u4e3a\u4ec0\u4e48\u8f93\u51fa$name\u65f6\u5374\u5f97\u4e0d\u5230\u4efb\u4f55\u503c? \u5728P [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-936","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=936"}],"version-history":[{"count":2,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/936\/revisions"}],"predecessor-version":[{"id":5238,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/936\/revisions\/5238"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}