public function upshow() { $str = getTypep(); $id = (int) $_GET['id']; $mOb = M("product"); $re = $mOb->where("id={$id}")->find(); $this->assign('str', $str); $this->assign('re', $re); $this->display(); }
function getTypep($fid = 0, $valueStr = "", $num = 0) { $mOb = M('Type'); $arr = $mOb->where("fid={$fid} and state=0")->select(); $optionStr = ""; $indentStr = str_repeat("--", $num); $num++; $valueStr .= $fid . ">"; foreach ($arr as $v) { $optionStr .= "<option value='{$valueStr}{$v['id']}>'>{$indentStr}{$v['tname']}</option>"; $reStr = getTypep($v['id'], $valueStr, $num); $optionStr .= $reStr; } return $optionStr; }