Php to achieve file download, web download is no problem, but the content of the file downloaded on the mobile phone is actually the content of the current html set of php files, what is the reason?

php implements file download, but the file downloaded on the web side is fine, but the content of the file downloaded on the mobile phone is actually the content of the current html set of php files. What is the reason for this?

    $path =  IA_ROOT."/".$datum["file_path"];

            $file_name  = substr($datum["file_path"],strrpos($datum["file_path"],"/")+1);
//            $file = fopen($path,"r"); // 
//            $file_size=filesize($path);
            header("Content-Type: application/octet-stream");
            header("Content-Disposition: attachment; filename=".$file_name);
            header("Accept-ranges:bytes");

            header("Content-Transfer-Encoding: binary");
            readfile($path);
Aug.09,2021
Menu