Rumah > Artikel > pembangunan bahagian belakang > thinkphp中一个方法调用另一个步骤的变量
thinkphp中一个方法调用另一个方法的变量
//实例化上传类<br /> public function upload() { <br /> $upload = new Upload();<br /> $upload->maxSize = 10 * 1024 * 1024;<br /> $upload->exts = array('jpg', 'jpeg', 'gif', 'txt','zip');<br /> $upload->savePath = './';<br /> $upload->hash = false;<br /> $info = $upload->upload();<br /> if (!$info) {<br /> $this->error($upload->getError());<br /> } <br /> else{<br /> foreach ($info as $file) {<br /> $uploadFile=$file['savepath'].$file['savename'];<br /> echo $uploadFile;<br /> } <br /> }<br /> }<br /> //添加文章<br /> public function addArticle(){<br /> $sort = $_POST['sort'];<br /> $title = $_POST['title'];<br /> $intro = $_POST['intro'];<br /> $pic = $_POST['pic'];<br /> $content = $_POST['content']; <br /> $articleSort= D('Article')->addArticle($sort,$title,$intro,$pic,$content);<br /> $this->display('Index/AddArticle');<br /> }