🗊Презентация РНР hypertext preprocessor language

Нажмите для полного просмотра!
РНР hypertext preprocessor language, слайд №1РНР hypertext preprocessor language, слайд №2РНР hypertext preprocessor language, слайд №3РНР hypertext preprocessor language, слайд №4РНР hypertext preprocessor language, слайд №5РНР hypertext preprocessor language, слайд №6РНР hypertext preprocessor language, слайд №7РНР hypertext preprocessor language, слайд №8РНР hypertext preprocessor language, слайд №9РНР hypertext preprocessor language, слайд №10РНР hypertext preprocessor language, слайд №11РНР hypertext preprocessor language, слайд №12РНР hypertext preprocessor language, слайд №13РНР hypertext preprocessor language, слайд №14РНР hypertext preprocessor language, слайд №15РНР hypertext preprocessor language, слайд №16РНР hypertext preprocessor language, слайд №17РНР hypertext preprocessor language, слайд №18РНР hypertext preprocessor language, слайд №19РНР hypertext preprocessor language, слайд №20РНР hypertext preprocessor language, слайд №21РНР hypertext preprocessor language, слайд №22РНР hypertext preprocessor language, слайд №23РНР hypertext preprocessor language, слайд №24РНР hypertext preprocessor language, слайд №25РНР hypertext preprocessor language, слайд №26РНР hypertext preprocessor language, слайд №27РНР hypertext preprocessor language, слайд №28РНР hypertext preprocessor language, слайд №29РНР hypertext preprocessor language, слайд №30

Вы можете ознакомиться и скачать презентацию на тему РНР hypertext preprocessor language. Доклад-сообщение содержит 30 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1


РНР hypertext preprocessor language, слайд №1
Описание слайда:

Слайд 2





Include Files
The include (or require) statement takes all the text/code/markup that exists in the specified file and copies it into the file that uses the include statement.
Including files is very useful when you want to include the same PHP, HTML, or text on multiple pages of a website.
Описание слайда:
Include Files The include (or require) statement takes all the text/code/markup that exists in the specified file and copies it into the file that uses the include statement. Including files is very useful when you want to include the same PHP, HTML, or text on multiple pages of a website.

Слайд 3





Example of include
<!DOCTYPE html>
<html>
<body>
<div class="menu">
<?php include 'menu.php';?>
</div>
<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
</body>
</html>
Описание слайда:
Example of include <!DOCTYPE html> <html> <body> <div class="menu"> <?php include 'menu.php';?> </div> <h1>Welcome to my home page!</h1> <p>Some text.</p> <p>Some more text.</p> </body> </html>

Слайд 4





PHP include vs. require
The require statement is also used to include a file into the PHP code.
However, there is one big difference between include and require; when a file is included with the include statement and PHP cannot find it, the script will continue to execute.
If we do the same example using the require statement, the echo statement will not be executed because the script execution dies after the require statement returned a fatal error.
Описание слайда:
PHP include vs. require The require statement is also used to include a file into the PHP code. However, there is one big difference between include and require; when a file is included with the include statement and PHP cannot find it, the script will continue to execute. If we do the same example using the require statement, the echo statement will not be executed because the script execution dies after the require statement returned a fatal error.

Слайд 5





File and file handleing
Описание слайда:
File and file handleing

Слайд 6





Simple syntax to read file in php
<?php
echo readfile("webdictionary.txt");
?>
Описание слайда:
Simple syntax to read file in php <?php echo readfile("webdictionary.txt"); ?>

Слайд 7





File Open/Read/Close
<?php
$myfile = fopen("webdictionary.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("webdictionary.txt"));
fclose($myfile);
?>
Описание слайда:
File Open/Read/Close <?php $myfile = fopen("webdictionary.txt", "r") or die("Unable to open file!"); echo fread($myfile,filesize("webdictionary.txt")); fclose($myfile); ?>

Слайд 8





Create and write on File
// create file
$myfile = fopen("testfile.txt", "w")
Описание слайда:
Create and write on File // create file $myfile = fopen("testfile.txt", "w")

Слайд 9





Forms and Files
Описание слайда:
Forms and Files

Слайд 10


РНР hypertext preprocessor language, слайд №10
Описание слайда:

Слайд 11





Create The Upload File PHP Script
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
?>
Описание слайда:
Create The Upload File PHP Script <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) {     $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);     if($check !== false) {         echo "File is an image - " . $check["mime"] . ".";         $uploadOk = 1;     } else {         echo "File is not an image.";         $uploadOk = 0;     } } ?>

Слайд 12





Check if File Already Exists
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
Описание слайда:
Check if File Already Exists // Check if file already exists if (file_exists($target_file)) {     echo "Sorry, file already exists.";     $uploadOk = 0; }

Слайд 13





Limit File Size
 // Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
//If the file is larger than 500KB, an error message is displayed
Описание слайда:
Limit File Size  // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) {     echo "Sorry, your file is too large.";     $uploadOk = 0; } //If the file is larger than 500KB, an error message is displayed

Слайд 14





Limit File Type
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
//The code only allows users to upload JPG, JPEG, PNG, and GIF files. All other file types gives an error message
Описание слайда:
Limit File Type // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) {     echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";     $uploadOk = 0; } //The code only allows users to upload JPG, JPEG, PNG, and GIF files. All other file types gives an error message

Слайд 15





Complete Upload File PHP Script (part 1)
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
Описание слайда:
Complete Upload File PHP Script (part 1) <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) {     $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);     if($check !== false) {         echo "File is an image - " . $check["mime"] . ".";         $uploadOk = 1;     } else {         echo "File is not an image.";         $uploadOk = 0;     } }

Слайд 16





Complete Upload File PHP Script (part 2)
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
Описание слайда:
Complete Upload File PHP Script (part 2) // Check if file already exists if (file_exists($target_file)) {     echo "Sorry, file already exists.";     $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) {     echo "Sorry, your file is too large.";     $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) {     echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";     $uploadOk = 0; }

Слайд 17





Complete Upload File PHP Script (part 3)
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}
?>
Описание слайда:
Complete Upload File PHP Script (part 3) // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) {     echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else {     if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {         echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";     } else {         echo "Sorry, there was an error uploading your file.";     } } ?>

Слайд 18





PHP Images from Folder
Описание слайда:
PHP Images from Folder

Слайд 19





Glob ()
The glob() function returns an array of filenames or directories matching a specified pattern.
This function returns an array of files/directories, or FALSE on failure.
Описание слайда:
Glob () The glob() function returns an array of filenames or directories matching a specified pattern. This function returns an array of files/directories, or FALSE on failure.

Слайд 20





Count ()
The count() function returns the number of elements in an array.
Описание слайда:
Count () The count() function returns the number of elements in an array.

Слайд 21





Opendir () & Readdir ()
Opendir is function to open a directory
Readdir  is function to read files in a directory that is open
Описание слайда:
Opendir () & Readdir () Opendir is function to open a directory Readdir is function to read files in a directory that is open

Слайд 22





PHP pathinfo() Function
The pathinfo() function returns an array that contains information about a path.
The following array elements are returned:
[dirname]
[basename]
[extension]
Описание слайда:
PHP pathinfo() Function The pathinfo() function returns an array that contains information about a path. The following array elements are returned: [dirname] [basename] [extension]

Слайд 23





in_array ()
It searches for a value  in an array
Описание слайда:
in_array () It searches for a value in an array

Слайд 24






<?php
$path = "images/"; // path to images folder
$file_count = count(glob($path . "*.{png,jpg,jpeg,gif}", GLOB_BRACE));
if($file_count > 0)
{
    $fp = opendir($path);
    while($file = readdir($fp))
    {
        $ext = pathinfo($file, PATHINFO_EXTENSION);
        $ext_array = ['png', 'jpg', 'jpeg', 'gif'];
        if (in_array($ext, $ext_array))
        {
            $file_path = $path . $file;?>
            <div class="col-md-4 col-xs-6">
                <a href="<?php echo $file_path; ?>" title="My Favorites" data-gallery><img src="<?php echo $file_path; ?>" class="img-responsive" /></a>
            </div>
        <?}
    }
    closedir($fp);
}
?>
Описание слайда:
<?php $path = "images/"; // path to images folder $file_count = count(glob($path . "*.{png,jpg,jpeg,gif}", GLOB_BRACE)); if($file_count > 0) { $fp = opendir($path); while($file = readdir($fp)) { $ext = pathinfo($file, PATHINFO_EXTENSION); $ext_array = ['png', 'jpg', 'jpeg', 'gif']; if (in_array($ext, $ext_array)) { $file_path = $path . $file;?> <div class="col-md-4 col-xs-6"> <a href="<?php echo $file_path; ?>" title="My Favorites" data-gallery><img src="<?php echo $file_path; ?>" class="img-responsive" /></a> </div> <?} } closedir($fp); } ?>

Слайд 25





PHP Error Handling
Описание слайда:
PHP Error Handling

Слайд 26





Error Handling
When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks.
This tutorial contains some of the most common error checking methods in PHP.
We will show different error handling methods:
Simple "die()" statements
Custom errors and error triggers
Error reporting
Описание слайда:
Error Handling When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. This tutorial contains some of the most common error checking methods in PHP. We will show different error handling methods: Simple "die()" statements Custom errors and error triggers Error reporting

Слайд 27





Example of Error Handling
Описание слайда:
Example of Error Handling

Слайд 28





Exception handling 
Exception handling is used to change the normal flow of the code execution if a specified error (exceptional) condition occurs. This condition is called an exception.
This is what normally happens when an exception is triggered:
The current code state is saved
The code execution will switch to a predefined (custom) exception handler function
Depending on the situation, the handler may then resume the execution from the saved code state, terminate the script execution or continue the script from a different location in the code
Описание слайда:
Exception handling Exception handling is used to change the normal flow of the code execution if a specified error (exceptional) condition occurs. This condition is called an exception. This is what normally happens when an exception is triggered: The current code state is saved The code execution will switch to a predefined (custom) exception handler function Depending on the situation, the handler may then resume the execution from the saved code state, terminate the script execution or continue the script from a different location in the code

Слайд 29





Exception handling example
When an exception is thrown, the code following it will not be executed, and PHP will try to find the matching "catch" block.
If an exception is not caught, a fatal error will be issued with an "Uncaught Exception" message.
Описание слайда:
Exception handling example When an exception is thrown, the code following it will not be executed, and PHP will try to find the matching "catch" block. If an exception is not caught, a fatal error will be issued with an "Uncaught Exception" message.

Слайд 30





Example of Try, throw and catch
<?php
//create function with an exception
function checkNum($number) {
  if($number>1) {
    throw new Exception("Value must be 1 or below");
  }
  return true;
}
//trigger exception in a "try" block
try {
  checkNum(2);
  //If the exception is thrown, this text will not be shown
  echo 'If you see this, the number is 1 or below';
}
//catch exception
catch(Exception $e) {
  echo 'Message: ' .$e->getMessage();
}
?>
Описание слайда:
Example of Try, throw and catch <?php //create function with an exception function checkNum($number) {   if($number>1) {     throw new Exception("Value must be 1 or below");   }   return true; } //trigger exception in a "try" block try {   checkNum(2);   //If the exception is thrown, this text will not be shown   echo 'If you see this, the number is 1 or below'; } //catch exception catch(Exception $e) {   echo 'Message: ' .$e->getMessage(); } ?>



Похожие презентации
Mypresentation.ru
Загрузить презентацию