찾다
백엔드 개발PHP 튜토리얼PHP 및 HTML5 FormData를 사용한 새로 고침 없는 파일 업로드 튜토리얼

이 글에서는 주로 PHP와 HTML5 FormData를 사용하여 새로 고침 없는 파일 업로드를 구현하는 방법을 소개하고, 마지막으로 프로그램 작성 단계를 자세히 설명하고 마지막으로 필요한 친구가 참조할 수 있도록 합니다.

새로 고침 없이 파일을 업로드하는 것은 일반적이고 다소 복잡한 문제입니다. 일반적인 해결책은 iframe을 구성하는 것입니다.

HTML5에서는 FormData 객체 API를 제공하므로 FormData를 통해 XMLHttpRequest를 통해 편리하게 양식 요청을 구성하고 보낼 수 있습니다. FormData 개체를 통해 파일을 보내는 것도 가능하므로 새로 고침 없이 업로드하는 것이 매우 간단해집니다.

그럼 FormData는 어떻게 사용하나요? 이에 대해 스크립트하우스에서는 아래에서 간략하게 소개하겠습니다.

1. FormData 개체 구성

FormData 개체를 가져오는 방법은 매우 간단합니다.

?

1

var fd = new FormData();</codebitstream></p></tdbitstream></tdbitstream></tr></tbody></table>1<tdbitstream vera sans mono new min-height:inherit background:none> <codebitstream vera sans mono border:0px float:none fd="새로운" formdata></codebitstream></tdbitstream></tdbitstream></tr></tbody></table> <p>FormData 개체는 양식 요청 매개변수를 개체에 추가하는 데 사용되는 추가 메서드 하나만 제공합니다. <br>현재 주류 브라우저에서는 다음 두 가지 방법으로 FormData를 얻거나 수정할 수 있습니다. <br>방법 1: 빈 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> <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>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 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></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 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></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>물론, fd에 다른 매개변수를 계속 추가하기 위해 Append 메소드를 사용할 수도 있습니다. </p> <p>2. FormData가 요청을 보냅니다. </p> <p> 이제 FormData 객체를 얻었으니 요청을 어떻게 보내나요? FormData 개체는 향상된 XMLHttpRequest 개체의 전송 메서드에 주로 사용됩니다. 다음 예를 참조하세요. <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> <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>xhr = <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>XMLHttpRequest();    </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.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></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> <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 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></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>.status == 200) {</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>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></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></tdbitstream></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>   <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>url: <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> <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>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 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></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>data: fd,</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 color:rgb background:none>*必须false才会自动加上正确的Content-Type</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> <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 color:rgb background:none>* 必须false才会避开jQuery对 formdata 的默认处理</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>* XMLHttpRequest会对 formdata 进行正确的处理</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>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></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> <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>}).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></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></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> <p>36</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> <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'

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
PHP의 현재 상태 : 웹 개발 동향을 살펴보십시오PHP의 현재 상태 : 웹 개발 동향을 살펴보십시오Apr 13, 2025 am 12:20 AM

PHP는 현대 웹 개발, 특히 컨텐츠 관리 및 전자 상거래 플랫폼에서 중요합니다. 1) PHP는 Laravel 및 Symfony와 같은 풍부한 생태계와 강력한 프레임 워크 지원을 가지고 있습니다. 2) Opcache 및 Nginx를 통해 성능 최적화를 달성 할 수 있습니다. 3) PHP8.0은 성능을 향상시키기 위해 JIT 컴파일러를 소개합니다. 4) 클라우드 네이티브 애플리케이션은 Docker 및 Kubernetes를 통해 배포되어 유연성과 확장 성을 향상시킵니다.

PHP 대 기타 언어 : 비교PHP 대 기타 언어 : 비교Apr 13, 2025 am 12:19 AM

PHP는 특히 빠른 개발 및 동적 컨텐츠를 처리하는 데 웹 개발에 적합하지만 데이터 과학 및 엔터프라이즈 수준의 애플리케이션에는 적합하지 않습니다. Python과 비교할 때 PHP는 웹 개발에 더 많은 장점이 있지만 데이터 과학 분야에서는 Python만큼 좋지 않습니다. Java와 비교할 때 PHP는 엔터프라이즈 레벨 애플리케이션에서 더 나빠지지만 웹 개발에서는 더 유연합니다. JavaScript와 비교할 때 PHP는 백엔드 개발에서 더 간결하지만 프론트 엔드 개발에서는 JavaScript만큼 좋지 않습니다.

PHP vs. Python : 핵심 기능 및 기능PHP vs. Python : 핵심 기능 및 기능Apr 13, 2025 am 12:16 AM

PHP와 Python은 각각 고유 한 장점이 있으며 다양한 시나리오에 적합합니다. 1.PHP는 웹 개발에 적합하며 내장 웹 서버 및 풍부한 기능 라이브러리를 제공합니다. 2. Python은 간결한 구문과 강력한 표준 라이브러리가있는 데이터 과학 및 기계 학습에 적합합니다. 선택할 때 프로젝트 요구 사항에 따라 결정해야합니다.

PHP : 웹 개발의 핵심 언어PHP : 웹 개발의 핵심 언어Apr 13, 2025 am 12:08 AM

PHP는 서버 측에서 널리 사용되는 스크립팅 언어이며 특히 웹 개발에 적합합니다. 1.PHP는 HTML을 포함하고 HTTP 요청 및 응답을 처리 할 수 ​​있으며 다양한 데이터베이스를 지원할 수 있습니다. 2.PHP는 강력한 커뮤니티 지원 및 오픈 소스 리소스를 통해 동적 웹 컨텐츠, 프로세스 양식 데이터, 액세스 데이터베이스 등을 생성하는 데 사용됩니다. 3. PHP는 해석 된 언어이며, 실행 프로세스에는 어휘 분석, 문법 분석, 편집 및 실행이 포함됩니다. 4. PHP는 사용자 등록 시스템과 같은 고급 응용 프로그램을 위해 MySQL과 결합 할 수 있습니다. 5. PHP를 디버깅 할 때 error_reporting () 및 var_dump ()와 같은 함수를 사용할 수 있습니다. 6. 캐싱 메커니즘을 사용하여 PHP 코드를 최적화하고 데이터베이스 쿼리를 최적화하며 내장 기능을 사용하십시오. 7

PHP : 많은 웹 사이트의 기초PHP : 많은 웹 사이트의 기초Apr 13, 2025 am 12:07 AM

PHP가 많은 웹 사이트에서 선호되는 기술 스택 인 이유에는 사용 편의성, 강력한 커뮤니티 지원 및 광범위한 사용이 포함됩니다. 1) 배우고 사용하기 쉽고 초보자에게 적합합니다. 2) 거대한 개발자 커뮤니티와 풍부한 자원이 있습니다. 3) WordPress, Drupal 및 기타 플랫폼에서 널리 사용됩니다. 4) 웹 서버와 밀접하게 통합하여 개발 배포를 단순화합니다.

과대 광고 : 오늘 PHP의 역할을 평가합니다과대 광고 : 오늘 PHP의 역할을 평가합니다Apr 12, 2025 am 12:17 AM

PHP는 현대적인 프로그래밍, 특히 웹 개발 분야에서 강력하고 널리 사용되는 도구로 남아 있습니다. 1) PHP는 사용하기 쉽고 데이터베이스와 완벽하게 통합되며 많은 개발자에게 가장 먼저 선택됩니다. 2) 동적 컨텐츠 생성 및 객체 지향 프로그래밍을 지원하여 웹 사이트를 신속하게 작성하고 유지 관리하는 데 적합합니다. 3) 데이터베이스 쿼리를 캐싱하고 최적화함으로써 PHP의 성능을 향상시킬 수 있으며, 광범위한 커뮤니티와 풍부한 생태계는 오늘날의 기술 스택에 여전히 중요합니다.

PHP의 약한 참고 자료는 무엇이며 언제 유용합니까?PHP의 약한 참고 자료는 무엇이며 언제 유용합니까?Apr 12, 2025 am 12:13 AM

PHP에서는 약한 참조가 약한 회의 클래스를 통해 구현되며 쓰레기 수집가가 물체를 되 찾는 것을 방해하지 않습니다. 약한 참조는 캐싱 시스템 및 이벤트 리스너와 같은 시나리오에 적합합니다. 물체의 생존을 보장 할 수 없으며 쓰레기 수집이 지연 될 수 있음에 주목해야합니다.

PHP의 __invoke 마법 방법을 설명하십시오.PHP의 __invoke 마법 방법을 설명하십시오.Apr 12, 2025 am 12:07 AM

\ _ \ _ 호출 메소드를 사용하면 객체를 함수처럼 호출 할 수 있습니다. 1. 객체를 호출 할 수 있도록 메소드를 호출하는 \ _ \ _ 정의하십시오. 2. $ obj (...) 구문을 사용할 때 PHP는 \ _ \ _ invoke 메소드를 실행합니다. 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 Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
4 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

맨티스BT

맨티스BT

Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

MinGW - Windows용 미니멀리스트 GNU

MinGW - Windows용 미니멀리스트 GNU

이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

PhpStorm 맥 버전

PhpStorm 맥 버전

최신(2018.2.1) 전문 PHP 통합 개발 도구

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.