note 108878 added to function.fopen

From: Date: Thu, 31 May 2012 16:30:23 +0000
Subject: note 108878 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-188340@lists.php.net to get a copy of this message
this will add dynamic content to the file <?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * Description of fle * * @author vijayk */ class fle_dtail { //put your code here protected $file_nm; protected $opration_mode; protected $fp; STATIC $FILE_NAME = 'PLEASE ENTER FILE NAME'; //set name for file. function __construct($get_file_nm) { $this->file_nm = $get_file_nm; } //file handling mode function opration_mode($op_md) { $this->opration_mode = $op_md; } //file opeining.. protected function open_file() { $this->fp = fopen($this->file_nm,$this->opration_mode) OR DIE('Problem opening file'); } } class file_hnd extends fle_dtail{ // public $data = 'To create a class, you need to use the keyword class followed by the name of the class. The name of the class should be meaningful to exist within the system (See note on naming a class towards the end of the article). The body of the class is placed between two curly brackets within which you declare class data members/variables and class methods.'; public $data; function __construct($get_file_nm,$tt) { $this->data = $tt; parent::__construct($get_file_nm); parent::opration_mode('w+'); parent::open_file(); //writing to a file. $this->writing_fil(); } //writing to file engine. function writing_fil() { fwrite(parent::$this->fp, $this->data); } } if(isset($_POST['submit'])) $obj = new file_hnd('demo.txt',$_POST['dat']); ?> <form method="post" action=""> <?php// ECHO PARENT::FILE_NAME?> <textarea name="dat"> </textarea> <input type="submit" name="submit" /> </form> ---- Server IP: 202.65.157.132 Probable Submitter: 1.23.228.213 ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- https://master.php.net/note/edit/108878 Del: integrated -- https://master.php.net/note/delete/108878/integrated Del: useless -- https://master.php.net/note/delete/108878/useless Del: bad code -- https://master.php.net/note/delete/108878/bad+code Del: spam -- https://master.php.net/note/delete/108878/spam Del: non-english -- https://master.php.net/note/delete/108878/non-english Del: in docs -- https://master.php.net/note/delete/108878/in+docs Del: other reasons-- https://master.php.net/note/delete/108878 Reject -- https://master.php.net/note/reject/108878 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188340) next »