PHP强制关闭一个文件,即使它在另一个进程中使用
我有一个压缩PDF文件的API。当API失败时,我需要取消该文件的链接,并出现“权限被拒绝”错误。如何强制关闭一个文件,即使它在另一个进程中使用?。我正在使用Windows平台PHP强制关闭一个文件,即使它在另一个进程中使用,php,windows,unlink,Php,Windows,Unlink,我有一个压缩PDF文件的API。当API失败时,我需要取消该文件的链接,并出现“权限被拒绝”错误。如何强制关闭一个文件,即使它在另一个进程中使用?。我正在使用Windows平台 if(move_uploaded_file($_FILES['researchfile']['tmp_name'], $target_path1)) { /** Call API to compress PDF **/ $API_response = compress_now($target_path1)
if(move_uploaded_file($_FILES['researchfile']['tmp_name'], $target_path1))
{
/** Call API to compress PDF **/
$API_response = compress_now($target_path1);
/** compress failed.File is still in use **/
if(isset($API_response->error))
{
unlink($target_path1);/** Couldnot unlink.Permission denied **/
}
}
请解释你的问题,并告诉我们你是如何试图实现的。我附上了我的代码片段@Siddiqui您的文件的权限是什么?这与权限无关。我需要关闭一个已在使用的文件