试了几种方法都解决不了,最后是逻辑错误,
贴出错误代码:
public function messageedit($message) {
$mess=M('message')->where("id='".$message."'")->find();
dump($mess);
$Code=M('code');
foreach ($mess as $value) {
$value['message_type']=$Code->where("id='".$value['message_type']."'")->find();
// dump($value['message_type']);exit;
$messagelist[]=$value;
}
dump($messagelist);exit;exit;
$this->assign('messagelist',$messagelist);
$this->display('ideasedit');
}
改成如下:
public function messageedit($message) {
$messagelist=M('message')->where("id='".$message."'")->find();
$Code=M('code');
$messagelist['message_type']=$Code->where("id='".$messagelist['message_type']."'")->getField('code');
$this->assign('messagelist',$messagelist);
dump($messagelist);exit;
$this->display('ideasedit');
}
乱码解决,可能是PHP底层的问题,抽时间研究下。。。