1.fread segmented read
2.readfile entire read
3.file_get_counts entire read
4.curl transfer
public function actionPak()
{
set_time_limit(0);
//
$post_data = file_get_contents("php://input");
// json
$json_obj = json_decode($post_data);
if (isset($json_obj->Num)) {
$file = \Yii::getAlias("@webroot") . "/pattern/pak/" . $json_obj->Num . ".pak";
//
ob_start();
readfile($file);
$data = ob_get_contents();
ob_end_clean();
return base64_encode($data);
} else {
return base64_encode("false");
}
}
all methods have been tried except for curl. The problem now is that there is no problem with small file transfer. When the file size is tens to hundreds of megabytes, the transfer will fail. Do you have any advice from the boss? thank you