1024 * 1024 * 3) { Helper::error('图片大小不能超过3M'); } $ext = strtolower(pathinfo($upArr['name'], PATHINFO_EXTENSION)); $upPath = "zqcrm/{$upType}/" . date('Ymd') . '/' . Helper::getRandomString(16) . '.' . $ext; Helper::imageUpload($upArr['tmp_name'], $upPath); if ($upType == 'editor') { exit(json_encode([ 'errno' => 0, 'data' => [ 'url' => Helper::getImageUrl($upPath), ], ])); } else { Helper::ok(['name' => $upPath, 'url' => Helper::getImageUrl($upPath)]); } } public function actionDeleteImg() { $path = Helper::getPostString('path'); if (empty($path)) { Helper::error('参数错误'); } Helper::dealCommonResult(Helper::imageDelete($path)); } /** * Logs out the current user and redirect to homepage. */ public function actionLogout() { Yii::app()->user->logout(); Helper::ok(); } }