function test(&$id, &$img){
        $photodata = file_get_contents($img);
        $url = UPLOAD_IMAGE_URL;
//        if ($compress == 'N') {
//            $url = UPLOAD_IMAGE_URL . '&compress=n';
//        }

        $upload = http_parse_message(http_post_data($url, $photodata));
        $result = (array) $upload;
        if (!empty($result) && $result['body']) {
            $newPicId = explode("=", $result['body']);
            if (!empty($newPicId[1]) && $newPicId[1] > 0) {
                $result[0] = true;
                $id = Lib_String::filterBlank(($newPicId[1]));
            } elseif (!empty($newPicId[1]) && $newPicId[1] <= 0) {
                $result[0] = false;
                $result[1] = "上传失败";
            } else {
                $result[0] = false;
                $result[1] = "上传失败";
            }
        } else {
            $result[0] = false;
            $result[1] = "上传失败";
        }
    }

 

    public static function filterBlank($str) {
        mb_regex_encoding('utf-8');
        $str = mb_ereg_replace(' ', '', $str);
        return trim($str);
    }

 

相关文章:

  • 2021-11-30
  • 2021-06-10
  • 2022-02-02
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-01
  • 2022-12-23
  • 2021-11-04
  • 2021-06-10
  • 2022-02-09
  • 2022-03-07
相关资源
相似解决方案