09/10/2018, 17:38
Ai Biet PHP Xin Help Dzum .
function MakeLogEntry($command)
{
//GET THE DATE
exec('date',$result);
$date = split(' ',$result[0]);
print (" Month: ".$date[1]." ");
$thetime = split(':',$date[3]);
if($thetime[0] < 12)
$s = "a.m.";
else
$s = "p.m.";
//PRINT ENTRY TO STDOUT
printf(" %-20.20s%10.10s%15.15s%20.20s ",$command,$this->file.".".$this->mrv,$this->cuser,$data[1]." ".$date[2]." ".$data[5]);
//PRINT ENTRY TO LOGFILE
chdir($this->logPath);
$fp = fopen($this->logfile,"a");
fwrite($fp,sprintf("%-20.20s%10.10s%15.15s%20.20s ",$command,$this->file.".".$this->mrv,$this->cuser,$data[1]." ".$date[2]." ".$data[5]));
fclose($fp);
}
N1N ddang ho.c PHP cho ne^n xin ca'c ba.n help ba`i homework na`y. N1N try to get output data and time. Example today is Nov 23,2002 and time is 2:52 p.m.. Nhu*ng N1N output chi? ra co' 23,2002 ma` tho^i. Ne^'u ai bie^'t xin help dzu`m nhe. Ba`i homework na`y due Tuesday. Thank you so much!!!!
{
//GET THE DATE
exec('date',$result);
$date = split(' ',$result[0]);
print (" Month: ".$date[1]." ");
$thetime = split(':',$date[3]);
if($thetime[0] < 12)
$s = "a.m.";
else
$s = "p.m.";
//PRINT ENTRY TO STDOUT
printf(" %-20.20s%10.10s%15.15s%20.20s ",$command,$this->file.".".$this->mrv,$this->cuser,$data[1]." ".$date[2]." ".$data[5]);
//PRINT ENTRY TO LOGFILE
chdir($this->logPath);
$fp = fopen($this->logfile,"a");
fwrite($fp,sprintf("%-20.20s%10.10s%15.15s%20.20s ",$command,$this->file.".".$this->mrv,$this->cuser,$data[1]." ".$date[2]." ".$data[5]));
fclose($fp);
}
N1N ddang ho.c PHP cho ne^n xin ca'c ba.n help ba`i homework na`y. N1N try to get output data and time. Example today is Nov 23,2002 and time is 2:52 p.m.. Nhu*ng N1N output chi? ra co' 23,2002 ma` tho^i. Ne^'u ai bie^'t xin help dzu`m nhe. Ba`i homework na`y due Tuesday. Thank you so much!!!!
Bài liên quan
http://www.php.net/manual/en/function.getdate.php