ホームページ >php教程 >php手册 >PHP は複数の画像をアップロードしてページに表示します

PHP は複数の画像をアップロードしてページに表示します

WBOY
WBOYオリジナル
2016-06-21 08:52:35986ブラウズ

次のコードに示すように、PHP は画像をアップロードしてページに表示します。

<ol class="dp-c"><li class="alt"><span><span><?php  </span></span></li><li><span><span class="vars">$id</span><span>=mysql_connect(</span><span class="string">'localhost'</span><span>,</span><span class="string">'root'</span><span>,</span><span class="string">'root'</span><span>); </span></span></li><li class="alt"><span>mysql_select_db(<span class="string">"db_database12"</span><span>,</span><span class="vars">$id</span><span>); </span></span></li><li><span>mysql_query(<span class="string">"set names gb2312"</span><span>); </span></span></li><li class="alt"><span>?> </span></span></li></ol>

index.php:

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><?</span><span class="tag-name">php</span><span>   </span></span></li><li><span>session_start(); </span></li><li class="alt"><span>include "conn.php";   </span></li><li><span>if ($<span class="attribute">page</span><span>=="")  </span></span></li><li class="alt"><span>{$<span class="attribute">page</span><span>=</span><span class="attribute-value">1</span><span>;}; </span></span></li><li><span><span class="tag">?></span><span> </span></span></li>
<li class="alt"><span><span class="tag"><</span><span class="tag-name">html</span><span class="tag">></span><span> </span></span></li>
<li><span><span class="tag"><</span><span class="tag-name">head</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"><</span><span class="tag-name">meta</span><span> </span><span class="attribute">http-equiv</span><span>=</span><span class="attribute-value">"Content-Type"</span><span> </span><span class="attribute">content</span><span>=</span><span class="attribute-value">"text/html; charset=gb2312"</span><span class="tag">></span><span> </span></span></li>
<li><span><span class="tag"><</span><span class="tag-name">title</span><span class="tag">></span><span>上传多图片到服务器并分页显示 - www.cxybl.com</span><span class="tag"></</span><span class="tag-name">title</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"><</span><span class="tag-name">style</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"text/css"</span><span class="tag">></span><span> </span></span></li>
<li><span><span class="comments"><!--</span> </span></li><li class="alt"><span><span class="comments">.style1 {font-size: 12px}</span> </span></li><li><span><span class="comments">--></span><span> </span></span></li>
<li class="alt"><span><span class="tag"></</span><span class="tag-name">style</span><span class="tag">></span><span> </span></span></li>
<li><span><span class="tag"></</span><span class="tag-name">head</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"><</span><span class="tag-name">body</span><span class="tag">></span><span> </span></span></li>
<li><span><span class="tag"><</span><span class="tag-name">table</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"450"</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"259"</span><span> </span><span class="attribute">border</span><span>=</span><span class="attribute-value">"0"</span><span> </span><span class="attribute">cellpadding</span><span>=</span><span class="attribute-value">"0"</span><span> </span><span class="attribute">cellspacing</span><span>=</span><span class="attribute-value">"0"</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>  <span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"134"</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"68"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"204"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"104"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li><span> <span class="tag"><</span><span class="tag-name">form</span><span> </span><span class="attribute">action</span><span>=</span><span class="attribute-value">"index_ok.php"</span><span> </span><span class="attribute">method</span><span>=</span><span class="attribute-value">"post"</span><span> </span><span class="attribute">enctype</span><span>=</span><span class="attribute-value">"multipart/form-data"</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"form1"</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>  <span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"30"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span class="tag"><</span><span class="tag-name">input</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"file[]"</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"file"</span><span> </span><span class="attribute">size</span><span>=</span><span class="attribute-value">"18"</span><span class="tag">></span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li><span>  <span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"30"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span class="tag"><</span><span class="tag-name">input</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"file[]"</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"file"</span><span> </span><span class="attribute">size</span><span>=</span><span class="attribute-value">"18"</span><span class="tag">></span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>  <span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"30"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span class="tag"><</span><span class="tag-name">input</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"file[]"</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"file"</span><span> </span><span class="attribute">size</span><span>=</span><span class="attribute-value">"18"</span><span class="tag">></span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li><span>  <span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"42"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">align</span><span>=</span><span class="attribute-value">"center"</span><span class="tag">></span><span class="tag"><</span><span class="tag-name">input</span><span> </span><span class="attribute">name</span><span>=</span><span class="attribute-value">"Submit"</span><span> </span><span class="attribute">type</span><span>=</span><span class="attribute-value">"submit"</span><span> </span><span class="attribute">id</span><span>=</span><span class="attribute-value">"Submit"</span><span> </span><span class="attribute">value</span><span>=</span><span class="attribute-value">"提交"</span><span class="tag">></span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"></</span><span class="tag-name">form</span><span class="tag">></span><span> </span></span></li>
<li><span>  <span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"60"</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>    <span class="tag"><</span><span class="tag-name">td</span><span class="tag">></span><span> </span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"></</span><span class="tag-name">table</span><span class="tag">></span><span> </span></span></li>
<li><span>  <span class="tag"><</span><span class="tag-name">table</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"450"</span><span> </span><span class="attribute">border</span><span>=</span><span class="attribute-value">"0"</span><span> </span><span class="attribute">cellspacing</span><span>=</span><span class="attribute-value">"0"</span><span> </span><span class="attribute">cellpadding</span><span>=</span><span class="attribute-value">"0"</span><span class="tag">></span><span>         </span></span></li>
<li class="alt"><span>         <span class="tag"><?</span><span class="tag-name">php</span><span> if ($page){ </span></span></li>
<li><span>                        $<span class="attribute">page_size</span><span>=</span><span class="attribute-value">4</span><span>; </span></span></li>
<li class="alt"><span>                        $<span class="attribute">query</span><span>=</span><span class="attribute-value">"select count(*) as total from tb_image2 where id"</span><span>; </span></span></li>
<li><span>                        $<span class="attribute">result</span><span>=</span><span class="attribute-value">mysql_query</span><span>($query); </span></span></li>
<li class="alt"><span>                        $<span class="attribute">message_count</span><span>=@mysql_result($result,0,"total"); </span></span></li>
<li><span>                        $<span class="attribute">page_count</span><span>=</span><span class="attribute-value">ceil</span><span>($message_count/$page_size);     </span></span></li>
<li class="alt"><span>                        $<span class="attribute">offset</span><span>=($page-1)*$page_size;              </span></span></li>
<li><span>                        for ($<span class="attribute">i</span><span>=</span><span class="attribute-value">1</span><span>; $i</span><span class="tag"><</span><span>=2; $i++) { </span></span></li>
<li class="alt"><span>                         echo "<span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span>"; </span></span></li>
<li><span>                        <span class="tag">?></span><span>              </span></span></li>
<li class="alt"><span>     <span class="tag"><?</span><span class="tag-name">php</span><span> if ($</span><span class="attribute">i</span><span>==1) { </span></span></li><li><span>           $<span class="attribute">query</span><span>=</span><span class="attribute-value">"select * from tb_image2 where id order by data desc limit $offset, $page_size"</span><span>;           </span></span></li><li class="alt"><span>              $<span class="attribute">result</span><span>=</span><span class="attribute-value">mysql_query</span><span>($query);} </span></span></li><li><span>                        $<span class="attribute">j</span><span>=</span><span class="attribute-value">1</span><span>;                       </span></span></li><li class="alt"><span>                        while ($<span class="attribute">myrow</span><span>=</span><span class="attribute-value">mysql_fetch_array</span><span>($result)){ </span></span></li><li><span>             if ($j<span class="tag"><</span><span>=2){  </span><span class="tag">?></span><span> </span></span></li>
<li class="alt"><span>              <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"150"</span><span> </span><span class="attribute">colspan</span><span>=</span><span class="attribute-value">"2"</span><span> </span><span class="attribute">align</span><span>=</span><span class="attribute-value">"center"</span><span> </span><span class="attribute">valign</span><span>=</span><span class="attribute-value">"middle"</span><span class="tag">></span><span>  </span></span></li>
<li><span>       <span class="tag"><</span><span class="tag-name">table</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"225"</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"150"</span><span> </span><span class="attribute">border</span><span>=</span><span class="attribute-value">"0"</span><span> </span><span class="attribute">cellspacing</span><span>=</span><span class="attribute-value">"0"</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>                  <span class="tag"><</span><span class="tag-name">tr</span><span> </span><span class="attribute">align</span><span>=</span><span class="attribute-value">"center"</span><span> </span><span class="attribute">valign</span><span>=</span><span class="attribute-value">"middle"</span><span class="tag">></span><span>  </span></span></li>
<li><span>                    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"225"</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"125"</span><span> </span><span class="attribute">align</span><span>=</span><span class="attribute-value">"center"</span><span> </span><span class="attribute">valign</span><span>=</span><span class="attribute-value">"middle"</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>         <span class="tag"><?</span><span class="tag-name">php</span><span> echo "</span><span class="tag"><</span><span class="tag-name">img</span><span> </span><span class="attribute">src</span><span>=\"$myrow[path]\" </span><span class="attribute">width</span><span>=\"224\" </span><span class="attribute">height</span><span>=\"120\"</span><span class="tag">></span><span>"</span><span class="tag">?></span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>                  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>                  <span class="tag"><</span><span class="tag-name">tr</span><span> </span><span class="attribute">align</span><span>=</span><span class="attribute-value">"left"</span><span> </span><span class="attribute">valign</span><span>=</span><span class="attribute-value">"top"</span><span class="tag">></span><span>  </span></span></li>
<li><span>                    <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">height</span><span>=</span><span class="attribute-value">"25"</span><span> </span><span class="attribute">align</span><span>=</span><span class="attribute-value">"center"</span><span> </span><span class="attribute">valign</span><span>=</span><span class="attribute-value">"middle"</span><span class="tag">></span><span>   </span></span></li>
<li class="alt"><span>          <span class="tag"><</span><span class="tag-name">span</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"style1"</span><span class="tag">></span><span class="tag"><?</span><span class="tag-name">php</span><span> echo $myrow[data];</span><span class="tag">?></span><span class="tag"></</span><span class="tag-name">span</span><span class="tag">></span><span> </span></span></li>
<li><span>                   <span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>                  <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li><span>                <span class="tag"></</span><span class="tag-name">table</span><span class="tag">></span><span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>              <span class="tag"><?</span><span class="tag-name">php</span><span>  } </span></span></li>
<li><span>                                        ++$j; </span></li>
<li class="alt"><span>                                        if ($<span class="attribute">j</span><span>==3){ </span></span></li>
<li><span>                                        break; </span></li>
<li class="alt"><span>                                        }} </span></li>
<li><span>                      echo "<span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span>"; } </span></span></li>
<li class="alt"><span>                    <span class="tag">?></span><span> </span></span></li>
<li><span><span class="tag"></</span><span class="tag-name">table</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"><</span><span class="tag-name">table</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"450"</span><span> </span><span class="attribute">border</span><span>=</span><span class="attribute-value">"0"</span><span> </span><span class="attribute">cellspacing</span><span>=</span><span class="attribute-value">"0"</span><span> </span><span class="attribute">cellpadding</span><span>=</span><span class="attribute-value">"0"</span><span class="tag">></span><span> </span></span></li>
<li><span>              <span class="tag"><</span><span class="tag-name">tr</span><span class="tag">></span><span>  </span></span></li>
<li class="alt"><span>                <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"50%"</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"style1"</span><span class="tag">></span><span>  页次:</span><span class="tag"><?</span><span class="tag-name">php</span><span> echo $page;</span><span class="tag">?></span><span> </span></span></li>
<li><span>                  / <span class="tag"><?</span><span class="tag-name">php</span><span> echo $page_count;</span><span class="tag">?></span><span> 页 记录:</span><span class="tag"><?</span><span class="tag-name">php</span><span> echo $message_count;</span><span class="tag">?></span><span>  </span></span></li>
<li class="alt"><span>                  条  <span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>                <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"39%"</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"style1"</span><span class="tag">></span><span> 分页:  </span></span></li>
<li class="alt"><span>                <span class="tag"><?</span><span class="tag-name">php</span><span>               </span></span></li><li><span>                $<span class="attribute">xsoudh</span><span>=</span><span class="attribute-value">"id=$id"</span><span>; </span></span></li><li class="alt"><span>                $<span class="attribute">next</span><span>=$ljjl*10; </span></span></li><li><span>                $<span class="attribute">n</span><span>=$ljjl-1; </span></span></li><li class="alt"><span>                $<span class="attribute">m</span><span>=$ljjl+1;  </span></span></li><li><span>                $<span class="attribute">prev_page</span><span>=$page-10;                         </span></span></li><li class="alt"><span>                    if ($<span class="attribute">ljjl</span><span>==0){ echo "";                  </span></span></li><li><span>                    }else{ </span></li><li class="alt"><span>                     echo "<span class="tag"><</span><span class="tag-name">a</span><span> </span><span class="attribute">href</span><span>=</span><span class="attribute-value">'$PATH_INFO?vv=0&ljjl=0&page=1&$xsoudh'</span><span class="tag">></span><span>首页</span><span class="tag"></</span><span class="tag-name">a</span><span class="tag">></span><span> "; </span></span></li>
<li><span>                     $<span class="attribute">ccc</span><span>=$vv-10; </span></span></li>
<li class="alt"><span>                     echo "<span class="tag"><</span><span class="tag-name">a</span><span> </span><span class="attribute">href</span><span>=</span><span class="attribute-value">'$PATH_INFO?vv=$ccc&ljjl=$n&page=$prev_page&$xsoudh'</span><span class="tag">></span><span>上十页</span><span class="tag"></</span><span class="tag-name">a</span><span class="tag">></span><span>"; </span></span></li>
<li><span>                    }<span class="tag">?></span><span> </span></span></li>
<li class="alt"><span>                  <span class="tag"><?</span><span class="tag-name">php</span><span>  </span></span></li><li><span>                for ($<span class="attribute">j</span><span>=</span><span class="attribute-value">1</span><span>;$j</span><span class="tag"><</span><span>=$page_count;$j++) { </span></span></li><li class="alt"><span>                       $<span class="attribute">pnext</span><span>=$next+$j; </span></span></li><li><span>                       if ($<span class="attribute">mm</span><span>==10){  break; } </span></span></li><li class="alt"><span>                       if ($mm<span class="tag">></span><span>$page_count){ break;} </span></span></li>
<li><span>                       if ($page_count-$vv<span class="tag"><</span><span class="tag-name">10</span><span>){ </span></span></li><li class="alt"><span>                       if ($mm<span class="tag">></span><span>=$page_count-$vv){break;}                                     </span></span></li>
<li><span>                    } <span class="tag">?></span><span> </span></span></li>
<li class="alt"><span>                  <span class="tag"><?</span><span class="tag-name">php</span><span> </span></span></li><li><span>                      echo "<span class="tag"><</span><span class="tag-name">a</span><span> </span><span class="attribute">href</span><span>=</span><span class="attribute-value">'$PATH_INFO?vv=$vv&ljjl=$ljjl&page=$pnext&$xsoudh'</span><span class="tag">></span><span> $pnext </span><span class="tag"></</span><span class="tag-name">a</span><span class="tag">></span><span>";                                            </span></span></li>
<li class="alt"><span>                        $<span class="attribute">mm</span><span>=$mm+1;                       </span></span></li>
<li><span>                 } </span></li>
<li class="alt"><span>                 <span class="tag">?></span><span> </span></span></li>
<li><span>                <span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span>                 <span class="tag"><</span><span class="tag-name">td</span><span> </span><span class="attribute">width</span><span>=</span><span class="attribute-value">"11%"</span><span> </span><span class="attribute">class</span><span>=</span><span class="attribute-value">"style1"</span><span class="tag">></span><span> </span></span></li>
<li><span>                  <span class="tag"><?</span><span class="tag-name">php</span><span>  $</span><span class="attribute">vv</span><span>=$vv+$mm;               </span></span></li><li class="alt"><span>                       if ($page_count-$vv<span class="tag"><</span><span>=0){ echo "";                     </span></span></li><li><span>                       }else{ </span></li><li class="alt"><span>                         echo "<span class="tag"><</span><span class="tag-name">a</span><span> </span><span class="attribute">href</span><span>=</span><span class="attribute-value">'$PATH_INFO?vv=$vv&ljjl=$m&page=$pnext&$xsoudh'</span><span class="tag">></span><span>下十页</span><span class="tag"></</span><span class="tag-name">a</span><span class="tag">></span><span>";                                                         </span></span></li>
<li><span>                       } </span></li>
<li class="alt"><span>                if ($<span class="attribute">message_count</span><span>==0){  echo "没有记录!";} </span></span></li>
<li><span>           }<span class="tag">?></span><span> </span></span></li>
<li class="alt"><span>                <span class="tag"></</span><span class="tag-name">td</span><span class="tag">></span><span> </span></span></li>
<li><span>              <span class="tag"></</span><span class="tag-name">tr</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"></</span><span class="tag-name">table</span><span class="tag">></span><span> </span></span></li>
<li><span><span class="tag"></</span><span class="tag-name">body</span><span class="tag">></span><span> </span></span></li>
<li class="alt"><span><span class="tag"></</span><span class="tag-name">html</span><span class="tag">></span><span> </span></span></li>
</ol>

index_ok.php:

<ol class="dp-c">
<li class="alt"><span><span><?php   </span></span></li><li><span>session_start(); </span></li><li class="alt"><span><span class="keyword">include</span><span> </span><span class="string">"conn.php"</span><span>;  </span></span></li><li><span>?> </span></span></li>
<li class="alt">
<span><?php </span></li><li><span><span class="keyword">if</span><span>(</span><span class="vars">$_POST</span><span>[</span><span class="string">"Submit"</span><span>]!=</span><span class="string">""</span><span>){ </span></span></li><li class="alt"><span>    <span class="keyword">if</span><span>(!</span><span class="func">is_dir</span><span>(</span><span class="string">"./upfile"</span><span>)){ </span></span></li><li><span>        <span class="func">mkdir</span><span>(</span><span class="string">"./upfile"</span><span>);} </span></span></li><li class="alt"><span>    <span class="keyword">for</span><span>(</span><span class="vars">$i</span><span>=0;</span><span class="vars">$i</span><span><</span><span class="func">count</span><span>(</span><span class="vars">$file</span><span>);</span><span class="vars">$i</span><span>++){ </span></span></li><li><span>        <span class="vars">$path</span><span>=</span><span class="string">"upfile/"</span><span>.</span><span class="func">date</span><span>(</span><span class="string">"Ymdhis"</span><span>).</span><span class="vars">$_FILES</span><span>[</span><span class="string">"file"</span><span>][</span><span class="string">"name"</span><span>][</span><span class="vars">$i</span><span>]; </span></span></li><li class="alt"><span>        move_uploaded_file(<span class="vars">$_FILES</span><span>[</span><span class="string">"file"</span><span>][</span><span class="string">"tmp_name"</span><span>][</span><span class="vars">$i</span><span>],</span><span class="vars">$path</span><span>); </span></span></li><li><span>        <span class="vars">$data</span><span>=</span><span class="func">date</span><span>(</span><span class="string">"Y-m-d H:m:s"</span><span>); </span></span></li><li class="alt"><span>        <span class="vars">$query</span><span>=</span><span class="string">"insert into tb_image2 (path,data) values ('$path','$data')"</span><span>;   </span></span></li><li><span>         <span class="comment">//创建插入图片数据的sql语句</span><span> </span></span></li><li class="alt"><span>        <span class="vars">$result</span><span>=mysql_query(</span><span class="vars">$query</span><span>);} </span></span></li><li><span>    <span class="func">echo</span><span> </span><span class="string">"图片上传成功,请稍等..."</span><span>; </span></span></li><li class="alt"><span>    <span class="func">echo</span><span> </span><span class="string">"<meta http-equiv=\"refresh\" content=\"3; url=index.php\">"</span><span>;} </span>
</li>
<li><span>?> </span></li>
</ol>



声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。