用 phpcms v9 制作前端用户提交信息时,有个图片上传的栏目。
如果注释 /phpcms/modules/attachment/attachment.php
20//判断是否登录 21 if(empty($this->userid)){ 22 showmessage(L('please_login','','member')); 23 }
88 if($this->isadmin==0 && !$grouplist[$this->groupid]['allowattachment']) showmessage(L('att_no_permission'));
就可以上传.最后没有注释,在/phpcms/modules/formguide/index.php 添加
class index { private $db, $m_db, $M; function __construct() { $this->db = pc_base::load_model('sitemodel_model'); $this->m_db = pc_base::load_model('sitemodel_field_model'); $this->M = new_html_special_chars(getcache('formguide', 'commons')); $this->siteid = intval($_GET[siteid]) ? intval($_GET[siteid]) : get_siteid(); $this->M = $this->M[$this->siteid]; $_SESSION['userid']='1'; //手动添加的,让attachment判断可以通过 $_SESSION['roleid']='1'; //手动添加的,让attachment判断可以通过 }