I want to write in 1.php before I can output "person" in $ msg on log.txt. the result of php is to change that (& #39; file transferred successfully & #39;) to that person. result 1 of php. phpperson. phpname $ name; $ this-& gt; age $ age;} php
The result of "person. php" output in $ msg on log.txt can be written in "1. php", that is, the result of changing "('Transfer to file successfully') to" person. php ".
// 1.php
Function writeLog ($ msg ){
$ LogFile = 'log.txt ';
Date_default_timezone_set ('Asia/Chongqing ');
$ Msg = date ('Y-m-d H: I: s'). '>>>'. $ msg. "\ r \ n ";
File_put_contents ($ logFile, $ msg, FILE_APPEND );
Require_once ('person. php ');
}
WriteLog ('file transferred successfully ');
?>
// Person. php
Class Person {
Public $ name;
Public $ age;
Function construct ($ name, $ age ){
$ This-> name = $ name;
$ This-> age = $ age;
}
Function show (){
Echo "my name is". $ this-> name ."";
}
}
$ Sxd = new Person ();
$ Sxd-> name = "sxd ";
$ Sxd-> age = 22;
$ Sxd-> show ();
Echo "age is". $ sxd-> age;
?>