PHP取消链接文件仍然显示,直到手动重新加载页面

PHP取消链接文件仍然显示,直到手动重新加载页面,php,Php,我从GitHub获得了源代码,它有一个index.php文件和一些inc扩展名,我创建了一个新的delete.inc扩展名,包含以下内容: <?php if ( !empty( $_GET['trash'] ) ) { $trash = $targetdir . '/' . $_GET['trash']; if ( file_exists( $trash ) ) { unlink($trash); //header('Refresh: 1;

我从GitHub获得了源代码,它有一个index.php文件和一些inc扩展名,我创建了一个新的delete.inc扩展名,包含以下内容:

<?php

if ( !empty( $_GET['trash'] ) ) {

$trash = $targetdir . '/' . $_GET['trash'];

    if ( file_exists( $trash ) ) {
    
    unlink($trash);
    
    //header('Refresh: 1; url=index.php');
    //header('Location: '.$_SERVER['REQUEST_URI']);
    //header("Location: index.php");
    //header("location:updateurl?id=0");
    //header("Refresh:0");  
    //getMedia($targetdir);
    

    
} else {
    header("HTTP/1.0 404 Not Found");
    exit();
}
}

永远不要使用GET参数来处理文件。这里有严重的安全问题。。所以至少要用post。无法与您的问题关联,因为整个代码/上下文缺失,但可能是订单问题。

想想如果有人在该url中放入
?垃圾=../../某个超级重要的文件,
…嗨,Aleksandar Trisic,完整代码位于