src/BaiduBce/Services/Bos/BosClient.php
public function getObjectAsString(
        $bucketName,
        $key,
        $options = array()
    ) {
        $outputStream = fopen('php://memory', 'r+');
        try {
            $this->getObject($bucketName, $key, $outputStream, $options);
            rewind($outputStream);
            $result = stream_get_contents($outputStream);
            if (is_resource($outputStream)) {
                fclose($outputStream);
            }
            return $result;
        } catch (\Exception $e) {
            if (is_resource($outputStream)) {
                fclose($outputStream);
            }
            throw $e;
        }
    }
public function getObjectAsString(
        $bucketName,
        $key,
        $options = array()
    ) {
        $outputStream = fopen('php://memory', 'r+');
        try {
            $this->getObject($bucketName, $key, $outputStream, $options);
            rewind($outputStream);
            $result = stream_get_contents($outputStream);
            if (is_resource($outputStream)) {
                fclose($outputStream);
            }
            return $result;
        } catch (\Exception $e) {
            if (is_resource($outputStream)) {
                fclose($outputStream);
            }
            throw $e;
        }
    }
public function getObjectAsString ( $ bucketName , $ key , $ options = array ( ) ) { $ outputStream = fopen ( 'php://memory' , 'r+' ) ; try { $ this -> getObject ( $ bucketName , $ key , $ outputStream , $ options ) ; rewind ( $ outputStream ) ; $ result = stream_get_contents ( $ outputStream ) ; if ( is_resource ( $ outputStream ) ) { fclose ( $ outputStream ) ; } return $ result ; } catch ( \ Exception $ e ) { if ( is_resource ( $ outputStream ) ) { fclose ( $ outputStream ) ; } throw $ e ; } }
Get the object cotent as string

@param string $bucketName The bucket name.
@param string $key The object path.
@param string $range If specified, only get the range part.
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating BosClient instance.
@return mixed
Get the object cotent as string