php get current timestamp

There is lots of way to get current timestamp. In php you can get current unix timestamp using time() function.Please use bellow given examples to get current unix timestamp. date_default_timezone_set(‘Asia/Calcutta’); //optional If PHP 5.3 generate Wornings then use it $cureentTimeStamp=time(); //current timestamp echo $cureentTimeStamp; echo ‘another Way’; echo strtotime(“now”);

Read more

PHP Download File Forcefully

In php there are some situation where you want to download file Forcefully.For that you have to use php header function. In header function you have to use Content-Type as application/octet-stream and Content-Disposition. ob_clean(); ob_start(); $filename=’private_movie.zip’; $absoluteFilePath=’/public_html/downloads/private_movie.zip’ header(“Pragma: public”); header (“Cache-Control: must-revalidate, post-check=0, pre-check=0”); header(“Cache-Control: maxage=1”); header (“Content-Type: application/octet-stream”); header (“Content-Length: ” . filesize($absoluteFilePath)); header (“Content-Disposition: attachment; filename=$filename”); readfile($absoluteFilePath);

Read more
1 2