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
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;