如何在字符集 CODE 737 php-laravel 下面设置我的代码
How to set to my code below charset CODE 737 php-laravel
public function downloadTXT()
{
$txt = "";
$datas = User::select('home_id','home_firstname','home_lastname')
->orderBy('home_id','desc')
->take(Input::get('number'))
->get();
foreach($datas as $data){
$txt .= 100000+$data['home_id'].' '.$data['home_firstname'].' '.$data['home_lastname'].PHP_EOL;
}
//$txtname = 'mytxt.txt';
$headers = ['Content-type: text/plain',
'test'=>'YoYo',
'Content-Disposition'=>sprintf('attachment; filename="%s"', Input::get('name')),
'X-BooYAH'=>'WorkyWorky',
//'Content-Length'=>sizeof($datas)
];
return Response::make($txt , 200, $headers );
}
我如何将 utf-8 字符集转换为代码 737,我什至不知道像 'utf-8'
这样的符号
CODE PAGE 737=>LINK
编辑
$txt = mb_convert_encoding($txt,'cp737');
这行不通....无法识别!
1) 所以我找到了解决方案希望这有助于 someone.First 我发现 PHP 和其他语言有它的功能“iconv”这是众所周知的!
2)其次你必须找到你需要的编码Net.name of the coding you need for windows
3)最后是使编码不同的代码
在 return 之前你必须转换 txt 文件
$txt = iconv("UTF-8","cp737","$txt");
所以这意味着从utf-8到cp737并且口渴参数是我们创建的txt文件!
public function downloadTXT()
{
$txt = "";
$datas = User::select('home_id','home_firstname','home_lastname')
->orderBy('home_id','desc')
->take(Input::get('number'))
->get();
foreach($datas as $data){
$txt .= 100000+$data['home_id'].' '.$data['home_firstname'].' '.$data['home_lastname'].PHP_EOL;
}
//$txtname = 'mytxt.txt';
$headers = ['Content-type: text/plain',
'test'=>'YoYo',
'Content-Disposition'=>sprintf('attachment; filename="%s"', Input::get('name')),
'X-BooYAH'=>'WorkyWorky',
//'Content-Length'=>sizeof($datas)
];
return Response::make($txt , 200, $headers );
}
我如何将 utf-8 字符集转换为代码 737,我什至不知道像 'utf-8'
这样的符号CODE PAGE 737=>LINK
编辑
$txt = mb_convert_encoding($txt,'cp737');
这行不通....无法识别!
1) 所以我找到了解决方案希望这有助于 someone.First 我发现 PHP 和其他语言有它的功能“iconv”这是众所周知的!
2)其次你必须找到你需要的编码Net.name of the coding you need for windows
3)最后是使编码不同的代码 在 return 之前你必须转换 txt 文件
$txt = iconv("UTF-8","cp737","$txt");
所以这意味着从utf-8到cp737并且口渴参数是我们创建的txt文件!