lundi 4 mars 2019

Is there a way to get data when processing on controller - Laravel PHP

I have a function on controller like crawl.

My Controller sometimes sleeping 10 seconds, sometimes go away. Like this

 while ($someTrueFalse) {
        $data[]=$gettingdata;

        $wantToPassText="Received ".count($data)." - Sleeping 10 seconds";

        if($someControl){
            $someTrueFalse=false;
        }

        sleep(10);
    }

    return view('any_view');

How can i access the $wantToPassText from any views?

I tried,

setcookie('data',$wantToPassText,time()+60);

But i can't accessing while controller processing. I can access only when process finishes.

I tried, write database this $wantToPassText, but i can't access again while processing.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire