Php file system function problems!

Source: Internet
Author: User
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;
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.