Reputation: 2510
i have created this small script which can be used to detect whether the file has changed or not. bt unfortunately its not working. Someone Pls help me out.
<?php
$l_m1 = filemtime("C:\wamp\www\learning\h.aspx");
print("filemtime1");
print($l_m1);
sleep(10);
$l_m2 = filemtime("C:\wamp\www\learning\h.aspx");
print("filemtime2");
print($l_m2);
if((int)$l_m1 != (int)$l_m2)
{
alert("the files are different");
system("start d:/kalimba.mp3");
}
Upvotes: 1
Views: 59
Reputation: 436
the filemtime function results of this function are cached
so you must use clearstatcache() to clears file status cache;
try below:
$l_m1 = filemtime("h.php");
print("filemtime1");
print($l_m1);
sleep(10);
clearstatcache();
$l_m2 = filemtime("h.php");
print("filemtime2");
print($l_m2);
if((int)$l_m1 != (int)$l_m2)
{
alert("the files are different");
system("start d:/kalimba.mp3");
}
Upvotes: 2