二、文章模块
<?php namespace Admin\Controller; use Think\Controller; class NewController extends CommonController{ /*** *文章管理 */ public function News_Index() { $this->display('newadd'); } /** * 图集模式 */ public function Picture_Index(){ $picture_list=M('picture')->select(); $this->assign('list',$picture_list); $this->display("picture"); } /** * 图片上传 */ public function Picture_upload(){ $config=array( 'maxSize' => 3145728, //文件大小 'rootPath'=>'./Public/admin/img/', //上传路径 'saveName' => array('uniqid',''), //图片保存名称 'exts' => array('jpg', 'gif', 'png', 'jpeg'), //图片格式 'autoSub' => true, //子目录 'subName' => array('date','Ymd') //子目录名称 ); $upload=new \Think\Upload($config); return $upload; } /** * 图集添加 */ public function Picture_add(){ $img=$this->Picture_upload(); $info=$img->upload(); $path=""; foreach($info as $file){ $path.=$file['savepath'].$file['savename']; } $data['path']=$path; M('picture')->add($data); } public function Picture_Del(){ } }