Q
Q
Quark_rgb2018-09-13 21:53:05
Laravel
Quark_rgb, 2018-09-13 21:53:05

Why are 2 headers being passed?

Help me figure out why 2 headers are being sent if I use blade mapping

public function __construct()
    {
        header('Content-type: text/html; charset=windows-1251', true, 200);

        $html = file_get_contents('https://www.kinopoisk.ru/top/lists/322/filtr/all/sort/year/');

        phpQuery::newDocument('<meta charset="windows-1251">' . $html);

        $section = pq('#itemList')->html();
//echo $section;
//exit();
        return view('pars_html.main', ['section' => $section]);
    }

<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta name="csrf-token" content="{{ csrf_token() }}">
<body>
<div class="container">
    <div class="row">
        <form method="post" action="{{ route('searchParsHTMLPost') }}">
            {{csrf_field()}}
            <input type="text" name="uid"><br>
            <input type="submit" name="search" value="search">
        </form>
        @yield('content')
        {!! $section !!}
    </div>
</div>
</body>
</html>

5b9ab1523b097810843777.jpeg
if I take it away
//echo $section;
//exit();

then everything is fine, only 1 installed
for earlier thanks is transmitted!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2018-09-15
@Quark_rgb

return response()
            ->view('pars_html.main', ['section' => $section], 200)
            ->header('Content-type: text/html; charset=windows-1251');

K
Kirill Nesmeyanov, 2018-09-14
@SerafimArts

Well, you yourself pass the second one on the third line of the constructor.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question