<div class="cnblogs_code">
PHP"
<div class="cnblogs_code">
PHP"
当前页面选择浏览:
选择文件:
后台处理:
</span><span style="color: #0000ff">for</span> (<span style="color: #800080">$i</span> = 0; <span style="color: #800080">$i</span> < <span style="color: #800080">$count</span>; <span style="color: #800080">$i</span>++<span style="color: #000000">) {
</span><span style="color: #0000ff">if</span> (<span style="color: #800080">$file</span>['size'][<span style="color: #800080">$i</span>] > 3145728<span style="color: #000000">) {
</span><span style="color: #800080">$this</span>->error("<a href="https://www.jb51.cc/tag/shangchuan/" target="_blank" class="keywords">上传</a><a href="https://www.jb51.cc/tag/wenjian/" target="_blank" class="keywords">文件</a>超过限定大小");<span style="color: #0000ff">exit</span><span style="color: #000000">;
}
</span><span style="color: #800080">$name</span> = <span style="color: #008080">strrchr</span>(<span style="color: #800080">$file</span>['name'][<span style="color: #800080">$i</span>],'.'<span style="color: #000000">);
</span><span style="color: #800080">$str</span> = <span style="color: #008080">rand</span>(111,999<span style="color: #000000">);
</span><span style="color: #800080">$tmpName</span> = <span style="color: #008080">date</span>('Y-m-d') . <span style="color: #800080">$str</span><span style="color: #000000">;
</span><span style="color: #800080">$newName</span> = <span style="color: #800080">$tmpName</span> . <span style="color: #800080">$name</span><span style="color: #000000">;
</span><span style="color: #800080">$upload_path</span> = "../Public/Images/zhongbiao/"<span style="color: #000000">;
</span><span style="color: #800080">$typeArr</span> = <span style="color: #0000ff">array</span>('.jpg','.jpeg','.png'<span style="color: #000000">);
</span><span style="color: #0000ff">if</span> (<span style="color: #800080">$file</span>['error'][<span style="color: #800080">$i</span>] == 0<span style="color: #000000">) {
</span><span style="color: #0000ff">if</span> (<span style="color: #008080">in_array</span>(<span style="color: #800080">$name</span>,<span style="color: #800080">$typeArr</span><span style="color: #000000">)) {
</span><span style="color: #0000ff">if</span> (<span style="color: #008080">is_uploaded_file</span>(<span style="color: #800080">$file</span>['tmp_name'][<span style="color: #800080">$i</span><span style="color: #000000">])) {
</span><span style="color: #0000ff">if</span> (<span style="color: #008080">move_uploaded_file</span>(<span style="color: #800080">$file</span>['tmp_name'][<span style="color: #800080">$i</span>],<span style="color: #800080">$upload_path</span> . <span style="color: #800080">$newName</span><span style="color: #000000">)) {
</span><span style="color: #800080">$fujian</span> = "fujian".<span style="color: #800080">$i</span>; <span style="color: #008000">//</span><span style="color: #008000"> 拼接 每张<a href="https://www.jb51.cc/tag/tupian/" target="_blank" class="keywords">图片</a>存入对应的字段.<a href="https://www.jb51.cc/tag/shujuku/" target="_blank" class="keywords">数据库</a> 设计 字段 dujian0,dujian1,dujian2...</span>
<span style="color: #800080">$data</span>[<span style="color: #800080">$fujian</span>] = <span style="color: #800080">$newName</span><span style="color: #000000">;
}
}
}
}
}
<span style="color: #000000"> <span style="color: #800080">$data['lsnumber'] = <span style="color: #800080">$_POST['<span style="color: #000000"><span style="color: #000000"><span style="color: #800080">lsnumber
'<span style="color: #000000">];