作者 刘锟

update

... ... @@ -79,7 +79,13 @@ class ProjectImport extends Command
//读取csv文件
$line_of_text = [];
try {
$file_handle = fopen($task->file_url, 'r');
$opts = [
'http' => [
'method' => 'GET',
'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'
]
];
$file_handle = fopen($task->file_url, 'r', null, stream_context_create($opts));
while (!feof($file_handle)) {
$line_of_text[] = fgetcsv($file_handle, 0, ',');
}
... ... @@ -183,7 +189,7 @@ class ProjectImport extends Command
protected function get_code_type($file)
{
$list = array('GBK', 'UTF-8');
$str = curl_c($file,false);
$str = curl_c($file, false);
foreach ($list as $item) {
$tmp = mb_convert_encoding($str, $item, $item);
if (md5($tmp) == md5($str)) {
... ...