Make Your Website Fast by httaccess Expires Time
3 Simple .Htaccess Rules For Better Website Performace .htaccess is the directory-level configuration file that allows us to adjust s...
Berbagi apapun yang saya tahu, berbagi tentang pendidikan, teknologi, website, dan lainnya.
3 Simple .Htaccess Rules For Better Website Performace .htaccess is the directory-level configuration file that allows us to adjust s...
The url protocol can be read out from the$_SERVER[‘SERVER_PROTOCOL’] variable.However if you check the value you can find that is not simply http or https but a string like this: HTTP/1.1
So we need some string manipulation to get a clean protocol string:Code:
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
As next step we need to figure out the hostname. This is in the$_SERVER[‘HTTP_HOST’]. You can read it simply like this:
The $_SERVER[‘SCRIPT_NAME’] contains the full path with the name of the actual php script as you can see here:
The last part of the current url is in the$_SERVER[‘QUERY_STRING’] and can be accessed similar to the others:
If the protocol and host name is not important for you but only the path, script name and the URL parameters then you can use simply$_SERVER[‘REQUEST_URI’] the as follows:
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https')
=== FALSE ? 'http' : 'https';
$host = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$params = $_SERVER['QUERY_STRING'];
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
echo $currentUrl;
Step 1 - Get current page URL PHP get current page URL In PHP there are some built in global variables that make the getting the cur...
Options +IndexesIndexIgnore filenameIndexIgnore readme.txtIndexIgnore *.phpApache HTTP Server comes with a useful feature for file viewing called “directory listing” or “directory browsing”. With this feature enabl...
$datetime1 = strtotime('May 3, 2012 10:38:22 GMT');
$datetime2 = strtotime('06 Apr 2012 07:22:21 GMT');
$secs = $datetime2 - $datetime1;// == <seconds between the two times>
$days = $secs / 86400;
Step 2 :$date1 = "2007-03-24";
$date2 = "2009-06-26";
$diff = abs(strtotime($date2) - strtotime($date1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
printf("%d years, %d months, %d days\n", $years, $months, $days);
You can two ways for find add and substract date. Try this : Step 1 $datetime1 = strtotime ( 'May 3, 2012 10:38:22 GMT' ); $da...
Take Care of Your Health As we enter the second decade of the 21st century, there is one thing nearly all modern Americans have in common:...
{1} Try rebooting the computer without any USB devices attached. Then plug in the USB drive, right click on My Computer, select manage, and...