Hello,
I'm trying to learn how to write some code for creating a text file in php, writing some data to that text file and save it using OOP.
Now i'm very new to OOP in php (although have done some work in C++ on it) and i'm trying to learn it rather than using normal php that I have found from examples and reading around on the net to come up with what i'm trying to achieve below.
Here's my code:
Now in this code I'm trying to write the f_header_text and f_footer_text to a file that's also created on the fly using this code.PHP Code:class IndesignFile
{
function IndesignFile()
{
$this->dbh = db_connect();
$date_time_stamp = date("d-m-Y");
$this->f_file_name = "/home/******/data/file-".$date_time_stamp.".txt";
$this->f_header_text = "<v2.05><e0>\r";
$this->f_header_text .= "@Normal=<Ps100t0h100z12k0b0cKf\"Helvetica\">\r";
$this->f_header_text .= "@Normal=[S\"\",\"Normal\",\"Normal\"]<*L*h\"Standard\"*kn0*kt0*ra0*rb0*d0*p(0,0,0,0,0,0,g,\"International English\")>\r";
$this->f_file_handle = fopen($this->f_file_name, 'a');
fwrite($this->f_file_handle, $this->f_header_text);
fclose($this->f_file_handle);
}
}
However when I run the script no file is created. Can someone please advise as to where i'm going wrong and any debugging I could put in the script to capture the errors?
Thanks




Bookmarks