SlideShare a Scribd company logo
Read and Write
1- Open connection to a file.
2- Process R/W Operation.
3- Close Connection.
You specify the operation (read or write)
when opening a file.
 In order to read or write to a file , you
have to get the write permissions.
 Permission is something to set on the
server operating system.
 Open file function return a handle ,
represents a connection to the opened
file.
o This is called resource data type.
 fopen need to specify name and path
(Rel/Abs) of the file and red or write mode.
 Use forward slashes ”/” of both Unix &
Windows.
 Is used to write the contents of a string to
file open for writing.
o File handle is one of it`s parameters.
 Return number of characters written on
success, otherwise return false.
 Fputs() is an alias.
 R+ is the access mode of writing.
$handle=fopen($path ,’ r+ ’)
$write=fwrite( $handle , $string )
If($write){ echo “Success”}
File pointer at the end of string
// Read about access modes
Get file path dynamically if
file name = query.txt
Data is encoded using URL-encoding by default.
Data included in the http body.
The form data should be of the content type
By setting the encrypt
attribute of html form
Multipart/form-data
“Multipart/form-data”
<input type = “file” name”upload”>
I/O PHP Files and classes
I/O PHP Files and classes
Real world
I/O PHP Files and classes
Refers to an instance of a class car().
Creating an object called
Instantiation
$mycar=new car();
Difference between object and class
objects
Class
Car
-color
-model
-top-speed
Red,Volovo,
220 k/h
White,Retmo,
160 k/h
Difference between object and class
Turn Class to an object
Class name:car
$mycar=new car();
Turn Class to an object
Class name:car
Class car{
Public $color;
Public $model;
Public $top_speed;
}
$mycar=new car();
$mycar->color=‘red’
$mycar->model=‘volvo’
$color=$mycar->color;
1439938978
seconds since
Jan 01 1970. (UTC)
What is the Unix time stamp?
http://php.net/manual/en/function.time.php

More Related Content

PPTX
File management in C++
PPTX
file management in c language
PDF
File_Management_in_C
DOCX
Files nts
PPTX
File Management in C
PPT
Mesics lecture files in 'c'
PDF
FILES IN C
PDF
File handling
File management in C++
file management in c language
File_Management_in_C
Files nts
File Management in C
Mesics lecture files in 'c'
FILES IN C
File handling

What's hot (20)

PPTX
Data file handling in python reading & writing methods
PDF
Files in C
PPT
file
PDF
File handling C program
PPTX
File handling in C by Faixan
PPT
FILE HANDLING IN C++. +2 COMPUTER SCIENCE CBSE AND STATE SYLLABUS
PPT
File Management
PPTX
File Management in C
PPT
File in C Programming
PPT
File handling
PDF
File handling in qbasic
PPTX
Programming in C
PPT
Deletion of a Record from a File - K Karun
PPTX
File handling
PPTX
PPTX
File Handling
PPTX
Filehandling
PDF
File Types in Data Structure
Data file handling in python reading & writing methods
Files in C
file
File handling C program
File handling in C by Faixan
FILE HANDLING IN C++. +2 COMPUTER SCIENCE CBSE AND STATE SYLLABUS
File Management
File Management in C
File in C Programming
File handling
File handling in qbasic
Programming in C
Deletion of a Record from a File - K Karun
File handling
File Handling
Filehandling
File Types in Data Structure
Ad

Similar to I/O PHP Files and classes (20)

PPT
Filing system in PHP
DOCX
Php files
PPT
php file uploading
PPT
PHP - Introduction to File Handling with PHP
PPTX
File accessing modes in c
PPTX
object oriented programming in PHP & Functions
PPTX
4 - Files and Directories - Pemrograman Internet Lanjut.pptx
PDF
File system
PPTX
php part 2
PDF
Web Development Course: PHP lecture 3
ODP
PHP BASIC PRESENTATION
PPTX
File handling
PDF
Tips
PPTX
Working of File System: An Overview in detail
PPT
UNIT-IV WT web technology for 1st year cs
Filing system in PHP
Php files
php file uploading
PHP - Introduction to File Handling with PHP
File accessing modes in c
object oriented programming in PHP & Functions
4 - Files and Directories - Pemrograman Internet Lanjut.pptx
File system
php part 2
Web Development Course: PHP lecture 3
PHP BASIC PRESENTATION
File handling
Tips
Working of File System: An Overview in detail
UNIT-IV WT web technology for 1st year cs
Ad

More from mohamedsaad24 (20)

PPTX
Kazdoura & Luciano Jan – Aug 2016 Cost Analysis
PPTX
Software Design
PPT
Visual Basic 6 Data Base
PPT
Visual Basic ADO
PPTX
Visual basic 6
PPTX
Create Contacts program with VB.Net
PPTX
Create Your first website
PPT
How Computer work
PPT
visual basic 6 Add Merlin
PPTX
My Bachelor project slides
PPTX
Difference between asp and php
PPTX
Error handling
PPTX
Php session 3 Important topics
PPT
Notify progresscontrol
PPT
Listbox+checkedlistbox
PPT
If then vs select case
PPT
If then vb2010
PPT
For next
PPT
Date & time picker
PPT
Combo box
Kazdoura & Luciano Jan – Aug 2016 Cost Analysis
Software Design
Visual Basic 6 Data Base
Visual Basic ADO
Visual basic 6
Create Contacts program with VB.Net
Create Your first website
How Computer work
visual basic 6 Add Merlin
My Bachelor project slides
Difference between asp and php
Error handling
Php session 3 Important topics
Notify progresscontrol
Listbox+checkedlistbox
If then vs select case
If then vb2010
For next
Date & time picker
Combo box

Recently uploaded (20)

PPTX
master seminar digital applications in india
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
GDM (1) (1).pptx small presentation for students
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Lesson notes of climatology university.
PDF
RMMM.pdf make it easy to upload and study
PDF
Classroom Observation Tools for Teachers
PDF
01-Introduction-to-Information-Management.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Institutional Correction lecture only . . .
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Sports Quiz easy sports quiz sports quiz
master seminar digital applications in india
Module 4: Burden of Disease Tutorial Slides S2 2025
GDM (1) (1).pptx small presentation for students
FourierSeries-QuestionsWithAnswers(Part-A).pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Complications of Minimal Access Surgery at WLH
Microbial diseases, their pathogenesis and prophylaxis
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Lesson notes of climatology university.
RMMM.pdf make it easy to upload and study
Classroom Observation Tools for Teachers
01-Introduction-to-Information-Management.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Supply Chain Operations Speaking Notes -ICLT Program
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPH.pptx obstetrics and gynecology in nursing
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Institutional Correction lecture only . . .
VCE English Exam - Section C Student Revision Booklet
Sports Quiz easy sports quiz sports quiz

I/O PHP Files and classes

  • 2. 1- Open connection to a file. 2- Process R/W Operation. 3- Close Connection. You specify the operation (read or write) when opening a file.
  • 3.  In order to read or write to a file , you have to get the write permissions.  Permission is something to set on the server operating system.
  • 4.  Open file function return a handle , represents a connection to the opened file. o This is called resource data type.  fopen need to specify name and path (Rel/Abs) of the file and red or write mode.  Use forward slashes ”/” of both Unix & Windows.
  • 5.  Is used to write the contents of a string to file open for writing. o File handle is one of it`s parameters.  Return number of characters written on success, otherwise return false.  Fputs() is an alias.  R+ is the access mode of writing.
  • 6. $handle=fopen($path ,’ r+ ’) $write=fwrite( $handle , $string ) If($write){ echo “Success”} File pointer at the end of string // Read about access modes Get file path dynamically if file name = query.txt
  • 7. Data is encoded using URL-encoding by default. Data included in the http body. The form data should be of the content type By setting the encrypt attribute of html form Multipart/form-data
  • 8. “Multipart/form-data” <input type = “file” name”upload”>
  • 13. Refers to an instance of a class car(). Creating an object called Instantiation $mycar=new car();
  • 16. Turn Class to an object Class name:car $mycar=new car();
  • 17. Turn Class to an object Class name:car Class car{ Public $color; Public $model; Public $top_speed; } $mycar=new car(); $mycar->color=‘red’ $mycar->model=‘volvo’ $color=$mycar->color;
  • 19. What is the Unix time stamp? http://php.net/manual/en/function.time.php