php导出utf8 csv解决打开乱码问题

private function export_csv($filename,$data) {
        header("Content-type:text/csv");
        header("Content-Disposition:attachment;filename=".$filename);
        header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
        header('Expires:0');
        header('Pragma:public');
        echo chr(239).chr(187).chr(191);
        echo $data;
    }

php随机生成MAC地址

php随机生成MAC地址代码,前三个为固定mac头,根据要用的更改

function mac_gen(){
	$array=array(
		0x1C,
		0x1C,
		0x1C,
		mt_rand(0x00, 0x7f),
		mt_rand(0x00, 0xff),
		mt_rand(0x00, 0xff)
	);
	return join(':',array_map(function($v){
		return sprintf("%02X",$v);
	},$array));
}