您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

thinkPHP 跨控制器模板输出有关问题

2025/3/22 12:17:22发布32次查看
thinkphp 跨控制器模板输出问题
先描述下问题
在首页index下面进行搜索,然后将搜索结果赋值给show模块下的show模板输出,
class indexaction extends action {//这里是index模块
public function index(){
//echo session(uid);
        $this->display();
}
public function dosearch(){//模糊查询
$user = m('user');
$key = $_request['keysearch'];
//$where['username'] = $key;
$where['username'] = array(like,array(%$key,$key%));
import('org.util.page');// 导入分页类
//$data=$user->where($where)->select();
$count=$user->where($where)->count();//条件查询总数
$page= new page($count,3);// 实例化分页类 传入总记录数和每页显示的记录数
foreach($where as $key=>$val) {
if(!is_array($val)) {
    $page->parameter   .=   $key=.urlencode($val).'&';
    }
}
$show = $page->show();// 分页显示输出
$mohulist = $user->where($where)->limit($page->firstrow.','.$page->listrows)->select();
$this->assign('users',$mohulist);
$this->assign('page',$show);// 赋值分页输出
$this->display('show/show'); //将搜索结果赋值给show模块下的show模型输出
}
可是一旦提交搜索表单 地址就会变成  http://www.tanss.com/alumni/index.php/index/dosearch
其实这样看似没有问题,但我需要对这个搜索的结果再进行操作,比如留言、等其他操作,所以当我在show模块下再写留言、等方法时就会报错说非法操作,像这种问题该怎么处理呢,
------解决思路----------------------
贴下报错看看
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product