文件写入
@access public
@param string $filename  文件名
@param string $content  文件内容
@return boolean
342845
public function put($filename,$content,$type=''){
        $dir         =  dirname($filename);
        if(!is_dir($dir)){
            mkdir($dir,0777,true);
        }
        if(false === file_put_contents($filename,$content)){
            E(L('_STORAGE_WRITE_ERROR_').':'.$filename);
        }else{
            $this->contents[$filename]=$content;
            return true;
        }
    }
315266
public function write($content, $filename, $pathToFile = null, $mode = "w")
    {
        if ($pathToFile == null) {
            $pathToFile = $this->_filePath;
        }

        $this->createDir($pathToFile);

        $fileHandle = fopen($pathToFile."/".$filename, $mode);
        $success = fwrite($fileHandle, $content);
        fclose($fileHandle);

        return $success;
    }
785129
public function input($filename, $content)
    {
        $this->_currentFile = $filename;
        return preg_replace_callback(
            $this->_pattern,
            array($this, '_replace'),
            $content
        );
    }
196335
public function read($file_name, $content = '')
    {
        if (!is_file($file_name)) {
            return false;
        }

        return file_get_contents($file_name, $content, LOCK_EX);
    }
316279
protected function saveFile($filename, $content)
	{
		$filename = $this->dir . $filename; 
		$f = fopen($filename, "wb");
		if($f)
		{
			if(fwrite($f, $this->processForFile($content)))
			{
				fclose($f);
				chmod($filename, 0600);
				return true;
			}
			fclose($f);
		}
		return false;
	}
118239
public function append($filename, $content)
    {
        if ($this->exists($filename) && $this->isFile($filename)) {
            return file_put_contents($filename, $content, FILE_APPEND);
        }

        throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
    }
969623
public static function detectByContent($content)
	{
		if (!class_exists('Finfo'))
		{
			return;
		}

		$finfo = new Finfo(FILEINFO_MIME_TYPE);
		$mimeType = $finfo->buffer($content);

		return $mimeType ?: null;
	}
1141216
public function put($file, $content)
    {
        $file = $this->path($file);

        $dirname = dirname($file);

        $this->makeDirectory($dirname);

        return file_put_contents($file, $content);
    }
656598
protected function saveFile($filename, $content)
    {
        if (!file_exists(dirname($filename))
            && mkdir(dirname($filename), 0777, true) === false
        ) {
            throw new GeneratorException(
                sprintf(
                    "Could not create directory '%s'.",
                    dirname($filename)
                )
            );
        }

        if (file_put_contents($filename, $content) === false) {
            throw new GeneratorException(
                sprintf(
                    "Could not open '%s' for writing.",
                    $filename
                )
            );
        }

        return $this;
    }
631821
protected function write($content): bool
    {
        if ($content === false || $content === null) {
            return false;
        }

        return \is_resource($content)
            ? $this->filesystem->putStream($this->path, $content)
            : $this->filesystem->put($this->path, $content);
    }
652458
public static function download($filename = '', $showname = '', $content = '')
    {
        // 得到下载长度
        if (file_exists($filename)) {
            $length = filesize($filename);
        } elseif ($content != '') {
            $length = strlen($content);
        } else {
            throw new ephpException('Not DownLoad Load File !');
        }

        // 最到显示的下载文件名
        if ($showname == '') {
            $showname = $filename;
        }

        $showname = basename($showname);

        // 发送Http Header信息 开始下载
        header("Content-type: application/octet-stream");
        header("Accept-Ranges: bytes");
        header("Accept-Length: " . $length);
        header("Content-Disposition: attachment; filename=" . $showname);

        // 优先下载指定的内容再下载文件
        if ($content == '') {
            $file = @fopen($filename, "r");
            if (!$file) {
                throw new ephpException('Not DownLoad Load File !');
            }
            // 一次读一K内容
            while (!@feof($file)) {
                echo @fread($file, 1024 * 1000);
            }

            @fclose($file);
        } else {
            exit($content);
        }
    }
189011
public function setFileRaw( string$key, string$contentType, string$content, string$fileName=null ):self
	{
		$this->files[$key]= [
			'fileName'=> $fileName??md5($content),
			'contentType'=> $contentType,
			'content'=> $content,
		];

		return $this;
	}
486210
public function write( $filename, $content )
    {
        if (!$this->authenticated) return false;
        global $wp_filesystem;
        return $wp_filesystem->put_contents(
            $filename,
            $content,
            defined( FS_CHMOD_FILE ) ? FS_CHMOD_FILE : ( 0644 & ~ umask() )
        );
    }
734318
function write($filename,$content){
		if(!Config::read('App.Base.enable_cache')){
			return;
		}
		$expire = time() + ($this->getConfig('cache_expiration') * 60);

		$filename = md5($filename);
		$filepath = $this->getConfig('cache_path').$filename.'.tmp';

		if ( ! $fp = @fopen($filepath, 'w')){
			Loader::getClass('Sky.core.Log')->write(400,'Unable to write cache file: '.$filepath);
			Exceptions::showError('error', "Unable to write cache file: ".$filepath);
			
		}
		if (flock($fp, LOCK_EX))
		{
			fwrite($fp, $expire.'T_SKY-->'.$content);
			flock($fp, LOCK_UN);
		}
		else{
			Loader::getClass('Sky.core.Log')->write(300,'Unable to secure a file lock for file at: '.$filepath);
			return;
		}
		fclose($fp);
		@chmod($filepath,0755);
		
	}
890378
public function update($filename, $content)
    {
        if ($this->exists($filename) && $this->isFile($filename)) {
            return $this->create($filename, $content);
        }

        throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
    }
556401
public function appendToFile($filename, $content)
    {
        if (\is_array($content)) {
            @trigger_error(sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), E_USER_DEPRECATED);
        }

        $dir = \dirname($filename);

        if (!is_dir($dir)) {
            $this->mkdir($dir);
        }

        if (!is_writable($dir)) {
            throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
        }

        if (false === @file_put_contents($filename, $content, FILE_APPEND)) {
            throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
        }
    }
344072
public function send($filename, $content)
    {
        $client = $this->getClient();
        $result = new BillResult();

        try {
            $zipContent = $this->compress($filename.'.xml', $content);
            $params = [
                'fileName' => $filename.'.zip',
                'contentFile' => $zipContent,
            ];
            $response = $client->call('sendBill', ['parameters' => $params]);
            $cdrZip = $response->applicationResponse;
            $result
                ->setCdrResponse($this->extractResponse($cdrZip))
                ->setCdrZip($cdrZip)
                ->setSuccess(true);
        } catch (\SoapFault $e) {
            $result->setError($this->getErrorFromFault($e));
        }

        return $result;
    }