mardi 14 juin 2016

How to declare timestamp only once in php or laravel?

I'm working on passing a timestamp to a page. Basically What I'm doing is get the current time in my controller and then passing it to the view. But the problem I have is that after the time stamp is render in the view and if I refresh the page I get different time. So is there anyway to just show a timestamp only ONCE and not let change by loading the page?? Thanks in advance:

Here's my code:

HomeController.php

public function orderingSubmissionReceipt()
{
    date_default_timezone_set('MST7MDT');
    $currentDateTime = date("F j, Y H:i:s");

    return view('order-summary', [
        'currentDateTime' => $currentDateTime
    ]);
 }

order-summary.blade.php

<div style="text-align: center;"><?php echo $currentDateTime ?></div>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire