1.fread分段读取
2.readfile整个读取
3.file_get_counts整个读取
4.curl传输
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');
}
}
海绵宝宝撒
随时随地看视频慕课网APP