当我们尝试下载invalide文件时,是否有一种方法可以投掷404,而不是200次,"8.2.1
感谢您的帮助
解决方案是覆盖下载文件控制器和视图方法:
namespace ApplicationControllerSinglePage;
use PageController;
use Core;
use Page;
use Permissions;
use ConcreteCoreEntityFileFile as FileEntity;
use ConcreteCoreFileFile;
use ConcreteControllerSinglePageDownloadFile as CoreDownloadFile;
class DownloadFile extends CoreDownloadFile
{
/**
* @param int $fID
* @param null $rcID
* @return bool
*/
public function view($fID = 0, $rcID = null)
{
//your code
//redirect to 404 whenever you want:
$this->replace('/page_not_found');
//...
}
}