CSS
- 1 ответ
- 0 вопросов
1
Вклад в тег
function getSplitChar($str) {
$s = preg_replace('/".+"/isU', '*', $str);
$a = [',',';','|']; //список разделителей
$r;
$i = -1;
foreach($a as $c) {
if(($n = sizeof(explode($c, $s))) > $i) {
$i = $n;
$r = $c;
}
}
return $r;
}
//открываем файл
$handle = fopen("test.csv", "r");
$header = fgets($handle);
$char = getSplitChar($header);
//переходим назад к первой строке
fseek($header, 0);
while (($data = fgetcsv($handle, 1000, $char)) !== FALSE) {
$num = count($data);
echo "
$num полей в строке $row:
\n";
$row++;
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "
\n";
}
}
fclose($handle);
Route::get('login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@showLoginForm']);
Route::post('login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@login']);
Route::get('logout', ['as' => 'auth.logout', 'uses' => 'Auth\AuthController@logout']);
// Registration Routes...
Route::get('register', ['as' => 'auth.register', 'uses' => 'Auth\AuthController@showRegistrationForm']);
Route::post('register', ['as' => 'auth.register', 'uses' => 'Auth\AuthController@register']);
// Password Reset Routes...
Route::get('password/reset/{token?}', ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@showResetForm']);
Route::post('password/email', ['as' => 'auth.password.email', 'uses' => 'Auth\PasswordController@sendResetLinkEmail']);
Route::post('password/reset', ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@reset']);