検索
ホームページバックエンド開発PHPチュートリアルPHP と HTML5 FormData を使用した、更新不要のファイル アップロード チュートリアル

この記事では主に、PHP と HTML5 FormData を使用して更新不要のファイル アップロードを実装するチュートリアルを紹介します。この記事では、最初にプログラムの作成手順を詳しく説明し、最後に必要な友人が参照できるように完全な例を示します。非更新ファイルのアップロードは一般的ですがやや複雑な問題であり、一般的な解決策は iframe を構築することです。

HTML5 では、FormData オブジェクト API が提供されており、FormData を通じてフォーム リクエストを簡単に構築し、XMLHttpRequest を通じて送信できます。 FormData オブジェクトを通じてファイルを送信することもできるため、更新せずにアップロードすることが非常に簡単になります。

では、FormData を使用するにはどうすればよいでしょうか? Script House はこれについて以下に簡単に紹介します。

1. FormData オブジェクトを構築する

FormData オブジェクトを取得したい場合は、非常に簡単です:


1

var fd = new FormData();

FormData オブジェクトは、フォーム リクエスト パラメーターをオブジェクトに追加するために使用される append メソッドを 1 つだけ提供します。
現在主流のブラウザでは、次の 2 つの方法で FormData を取得または変更できます。
方法 1: 空の FormData オブジェクトを作成し、append メソッドを使用してキーと値のペアを 1 つずつ追加します。例:

?

1

2

3

4

var<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>fd = <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>new<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>FormData();</codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>fd.append(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"name"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>、 <codebitstream vera sans mono new float:none font-size:1em min-height:>"脚本之家"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"脚本之家"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>);</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p>);🎜🎜<p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>fd.append(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"blog"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>、 <codebitstream vera sans mono new float:none font-size:1em min-height:>"http://jb51.net"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"http://jb51.net"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>);</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p>);🎜🎜<p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>fd.append(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"file"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>、 document.getElementById(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"file"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>));</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p>));</tdbitstream></tdbitstream></tr></tbody></table>🎜🎜<p>このメソッドは、HTML フォーム オブジェクトの存在を必要としません。 <br>方法 2: フォーム要素オブジェクトを取得し、それをパラメーターとして FormData オブジェクトに渡します。例: <br></p> <p></p> <p></p> <p><divbitstream vera sans mono new min-height:inherit z-index:10 color:white background:rgb><span>?</span></divbitstream></p> <table border="0" cellpadding="0" cellspacing="0" bitstream vera sans mono new min-height:inherit background:none><tbody><tr><tdbitstream vera sans mono new min-height:inherit color:rgb background:none><p>1</p> <p>2</p> <tdbitstream vera sans mono new min-height:inherit background:none><p></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>var<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>formobj = document.getElementById(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"form"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>);</codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>var<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>fd = <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>new<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>FormData(formobj);</codebitstream></codebitstream></codebitstream></codebitstream></p></tdbitstream></tdbitstream></tr></tbody></table> <p>もちろん、append メソッドを使用して、fd に他のパラメータを追加し続けることもできます。 </p> <p>2. FormData はリクエストを送信します</p> <p>FormData オブジェクトを取得したので、どのようにリクエストを送信すればよいでしょうか? FormData オブジェクトは主に、拡張された XMLHttpRequest オブジェクトの send メソッドで使用されます。次の例を参照してください。 <br>8</p> <p></p> <p></p> <p><divbitstream vera sans mono new min-height:inherit z-index:10 color:white background:rgb><span></span><p><codebitstream vera sans mono new float:none font-size:1em min-height: background:none important>xhr.open(<codebitstream vera sans mono new important border:0px float:none background:none>"POST"<codebitstream vera sans mono new important border:0px float:none font-size:1em min-height:>,<codebitstream vera sans mono new border:0px : important>"http://jb51.net"<codebitstream vera sans mono new float:none font-size:1em min-height:>, <codebitstream vera sans mono new border:0px : :rgb>true<codebitstream vera sans mono new important float:none font-size:1em min-height:>);<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>xhr.open(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"POST"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>,<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"http://jb51.net"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>, <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>true<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>);</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>xhr.send(fd);</codebitstream></p> <codebitstream vera sans mono new border:0px>xhr.send(fd);🎜<p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>xhr.onload = <codebitstream vera sans mono new float:none font-size:1em min-height:>関数<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>function<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>(e) {</codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>if<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>this <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none><codebitstream vera sans mono new float:none font-size:1em min-height:>if</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p>(🎜<codebitstream vera sans mono new border:0px : :rgb>この🎜🎜.ステータス == 200) {🎜🎜<p><codebitstream vera sans mono new float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px em><codebitstream vera sans mono font-size:1em min-height: background:none important>this<codebitstream vera sans mono new important border:0px float:none height: :auto><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>    <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>alert(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>this<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>.responseText);</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>}</codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>};</codebitstream></p> <codebitstream vera sans mono new float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px code></codebitstream></codebitstream></codebitstream></codebitstream></divbitstream></p> <codebitstream vera sans mono new float:none font-size:1em min-height:>};</codebitstream></tdbitstream></tr></tbody></table>🎜🎜🎜<p>3. jquery で FormData を使用する</p> <p> jQuery の ajax メソッドでは、FormData メソッドを使用して更新なしのアップロードを実現することもできます。ただし、パラメータ設定に注意してください。参照は次のとおりです: <br></p> <p></p> <p></p> <p><divbitstream vera sans mono new min-height:inherit z-index:10 color:white background:rgb><span>?</span></divbitstream></p> <table border="0" cellpadding="0" cellspacing="0" bitstream vera sans mono new min-height:inherit background:none><tbody><tr><tdbitstream vera sans mono new min-height:inherit color:rgb background:none><p>1</p> <p>2</p> <p>3</p> <p>4</p> <p>5</p> <p>6</p> <p>7 </p> <p> 8</p> <p>9</p> <p>10</p> <p>11</p> <p>12</p> <p>13</p> <p>14</p> <p>15</p> <p>16</p> <p>17</p> <p>18</p> <tdbitstream vera sans mono new min-height:inherit background:none><p></p> <p> <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>$.ajax({</codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  $.ajax({ <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>"http://jb51.net"<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>,</codebitstream></codebitstream></codebitstream></codebitstream></p> 🎜🎜url: 🎜<codebitstream vera sans mono><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>入力: <codebitstream vera sans mono new float:none font-size:1em min-height:>「投稿」<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:blue background:none>'POST'<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>,<p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>,</codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:rgb background:none>/**</codebitstream></codebitstream></p>データ: fd,🎜🎜🎜🎜<codebitstream vera sans mono new float:none font-size:1em min-height:>/**🎜🎜<p><codebitstream vera sans mono new float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px background:none important>* 必須须偽才会自动加上正确的 Content-Type<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>   <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:rgb background:none>*必须false才会自动加上正确的Content-Type</codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>   <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:rgb background:none>*/</codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>contentType:<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>false<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>,</codebitstream></codebitstream></codebitstream></codebitstream></p> <codebitstream vera sans mono new important float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px>*/🎜🎜<codebitstream vera sans mono new important float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px><codebitstream vera sans mono new float:none font-size:1em min-height: background:none important>false<codebitstream vera sans mono new important border:0px float:none height: :auto>🎜<p><codebitstream vera sans mono new float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:rgb background:none>/**</codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>   <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:rgb background:none>/**</codebitstream></codebitstream></p> <p><codebitstream vera sans mono new float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>   <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:rgb background:none>* 必須; false 才は jQuery の formdata の默认处処理を避ける必要があります</codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new important float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>   <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit color:rgb background:none>*/</codebitstream></codebitstream></codebitstream></p>* XMLHttpRequest会对 formdata は正しい処理を実行します🎜🎜🎜<codebitstream vera sans mono new important float:none font-size:1em min-height:> 🎜🎜*/🎜🎜<p><codebitstream vera sans mono new float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px><codebitstream vera sans mono new float:none font-size:1em min-height: background:none important>false<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>processData:<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>false</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>}).done(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>function<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>(result){</codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>console.log(result);</codebitstream></codebitstream></p> <codebitstream vera sans mono new important border:0px float:none><codebitstream vera sans mono new border:0px font-size:1em min-height: background:none important>関数<codebitstream vera sans mono new important border:0px float:none height: :auto>🎜🎜<codebitstream vera sans mono new float:none font-size:1em min-height:> <codebitstream vera sans mono new border:0px>🎜<p><codebitstream vera sans mono new float:none font-size:1em min-height: background:none important>}).fail(<codebitstream vera sans mono new important border:0px float:none>関数<codebitstream vera sans mono new :0px font-size:1em min-height:>(エラー){<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>}).fail(<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-weight:bold font-size:1em min-height:inherit color:rgb background:none>function<codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>(err){</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>  <codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>console.log(err);</codebitstream></codebitstream></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none>});</codebitstream></p> <codebitstream vera sans mono new important border:0px float:none> <codebitstream vera sans mono new float:none font-size:1em min-height: background:none important>console.log(err);<codebitstream vera sans mono new important border:0px :none>});</codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></codebitstream></tdbitstream></tdbitstream></tr></tbody></table>🎜🎜🎜<p>4. 完全な例 (PHP 処理の例を含む): <br></p> <p></p> <p></p> <p><divbitstream vera sans mono new min-height:inherit z-index:10 color:white background:rgb><span>?</span></divbitstream></p> <table border="0" cellpadding="0" cellspacing="0" bitstream vera sans mono new min-height:inherit background:none><tbody><tr><tdbitstream vera sans mono new min-height:inherit color:rgb background:none><p>1</p> <p>2</p> <p>3</p> <p>4</p> <p>5</p> <p>6</p> <p>7 </p> <p>8</p> <p>9</p> <p>10</p> <p>11</p> <p>12</p> <p>13</p> <p>14</p> <p>15</p> <p>16</p> <p>17</p> <p>18</p> <p>19 </p> <p>20</p> <p>21</p> <p>22</p> <p>23</p> <p> 24</p> <p>25</p> <p>26</p> <p>27</p> <p>28</p> <p>29</p> <p>30</p> <p>31</p> <p>32</p> <p>33</p> <p>34</p> <p>35</p>3 6<p></p>37<p></p>38<p></p>39<p></p>40<p> </p>41<p></p>42<p></p>43<p></p>44<p></p>45<p></p>46<p></p>47<p></p>48<p></p>49<p></p>50<p></p>51<p></p>52<p> </p>53<p></p>54<p></p>55<p></p>56<p></p>57 <p></p>58<p></p>59<p></p>60<p></p>61<p></p>62<p></p>63<p></p>64<p></p>65<p></p> <tdbitstream vera sans mono new min-height:inherit background:none><p></p> <p><codebitstream vera sans mono new border:0px bottom:auto float:none height:auto left:auto line-height:1.1em margin:0px outline:0px overflow:visible padding:0px position:static right:auto top:auto vertical-align:baseline width:auto font-size:1em min-height:inherit background:none><?php

//php フォーム送信情報を受け取って印刷します

if( isset( $_REQUEST['do'🎜[🎜'do'🎜

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
誇大広告を超えて:今日のPHPの役割の評価誇大広告を超えて:今日のPHPの役割の評価Apr 12, 2025 am 12:17 AM

PHPは、特にWeb開発の分野で、最新のプログラミングで強力で広く使用されているツールのままです。 1)PHPは使いやすく、データベースとシームレスに統合されており、多くの開発者にとって最初の選択肢です。 2)動的コンテンツ生成とオブジェクト指向プログラミングをサポートし、Webサイトを迅速に作成および保守するのに適しています。 3)PHPのパフォーマンスは、データベースクエリをキャッシュおよび最適化することで改善でき、その広範なコミュニティと豊富なエコシステムにより、今日のテクノロジースタックでは依然として重要になります。

PHPの弱い参照は何ですか、そしていつ有用ですか?PHPの弱い参照は何ですか、そしていつ有用ですか?Apr 12, 2025 am 12:13 AM

PHPでは、弱い参照クラスを通じて弱い参照が実装され、ガベージコレクターがオブジェクトの回収を妨げません。弱い参照は、キャッシュシステムやイベントリスナーなどのシナリオに適しています。オブジェクトの生存を保証することはできず、ごみ収集が遅れる可能性があることに注意する必要があります。

PHPで__invoke Magicメソッドを説明してください。PHPで__invoke Magicメソッドを説明してください。Apr 12, 2025 am 12:07 AM

\ _ \ _ Invokeメソッドを使用すると、オブジェクトを関数のように呼び出すことができます。 1。オブジェクトを呼び出すことができるように\ _ \ _呼び出しメソッドを定義します。 2。$ obj(...)構文を使用すると、PHPは\ _ \ _ Invokeメソッドを実行します。 3。ロギングや計算機、コードの柔軟性の向上、読みやすさなどのシナリオに適しています。

同時性については、PHP 8.1の繊維を説明します。同時性については、PHP 8.1の繊維を説明します。Apr 12, 2025 am 12:05 AM

繊維はPhp8.1で導入され、同時処理機能が改善されました。 1)繊維は、コルーチンと同様の軽量の並行性モデルです。 2)開発者がタスクの実行フローを手動で制御できるようにし、I/O集約型タスクの処理に適しています。 3)繊維を使用すると、より効率的で応答性の高いコードを書き込むことができます。

PHPコミュニティ:リソース、サポート、開発PHPコミュニティ:リソース、サポート、開発Apr 12, 2025 am 12:04 AM

PHPコミュニティは、開発者の成長を支援するための豊富なリソースとサポートを提供します。 1)リソースには、公式のドキュメント、チュートリアル、ブログ、LaravelやSymfonyなどのオープンソースプロジェクトが含まれます。 2)StackOverFlow、Reddit、およびSlackチャネルを通じてサポートを取得できます。 3)開発動向は、RFCに従うことで学ぶことができます。 4)コミュニティへの統合は、積極的な参加、コード共有への貢献、および学習共有への貢献を通じて達成できます。

PHP対Python:違いを理解しますPHP対Python:違いを理解しますApr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHPは、シンプルな構文と高い実行効率を備えたWeb開発に適しています。 2。Pythonは、簡潔な構文とリッチライブラリを備えたデータサイエンスと機械学習に適しています。

PHP:それは死にかけていますか、それとも単に適応していますか?PHP:それは死にかけていますか、それとも単に適応していますか?Apr 11, 2025 am 12:13 AM

PHPは死にかけていませんが、常に適応して進化しています。 1)PHPは、1994年以来、新しいテクノロジーの傾向に適応するために複数のバージョンの反復を受けています。 2)現在、電子商取引、コンテンツ管理システム、その他の分野で広く使用されています。 3)PHP8は、パフォーマンスと近代化を改善するために、JITコンパイラおよびその他の機能を導入します。 4)Opcacheを使用してPSR-12標準に従って、パフォーマンスとコードの品質を最適化します。

PHPの未来:適応と革新PHPの未来:適応と革新Apr 11, 2025 am 12:01 AM

PHPの将来は、新しいテクノロジーの傾向に適応し、革新的な機能を導入することで達成されます。1)クラウドコンピューティング、コンテナ化、マイクロサービスアーキテクチャに適応し、DockerとKubernetesをサポートします。 2)パフォーマンスとデータ処理の効率を改善するために、JITコンパイラと列挙タイプを導入します。 3)パフォーマンスを継続的に最適化し、ベストプラクティスを促進します。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

WebStorm Mac版

WebStorm Mac版

便利なJavaScript開発ツール

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

SublimeText3 Linux 新バージョン

SublimeText3 Linux 新バージョン

SublimeText3 Linux 最新バージョン

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター