我正在返回一个 json 数组并尝试在控制器中接收它,但它没有显示任何结果这是我的模型:
if ((!empty($_FILES["FlMediaImage"])) &&($_FILES["FlMediaImage"]["error"] == 0)) {
$mdImgName = $_FILES["FlMediaImage"]["name"];
$ext = substr($mdImgName, strpos($mdImgName, '.') + 1);
$mdImgName = 'adsmind_media_' . md5(uniqid(time(), true)) . '.' . $ext;
move_uploaded_file($_FILES["FlMediaImage"]["tmp_name"], ROOT . "/images/temp/" . $mdImgName);
}
$jsonArry = array(
"image_id" => 0,
"image_name" => $result->$mdImgName
);
return json_encode(array('result' => $jsonArry));
我的控制器是:
$imageJSON = json_decode($modObj->saveMediaImage());
$imageID = $imageJSON->result->image_id;
$imageName = $imageJSON->result->image_name;