PHP include and require

PHP Include and Require In Hindi – File Include In Hindi

PHP

PHP Include and Require In HindiPHP File Include In Hindi:- Include Ka Matlab Hota Hain Include Karna Or Require Ka Matlab Hota Hain Required Hai. Inhe Ham Example Ke Sath Understand Karte Hain |

PHP Include and Require In Hindi

PHP Mai Ek File Mai Dusre File Ka Content Istemal Kiya Jata Hain. Iske Liye PHP Mai 2 Functions Hain |

  1. include() function
  2. require() function

Inka Istemal Karke PHP Program Files Easy Ho Jati Hai. Isse Programmer Ka Time Bhi Bachta Hai and Long Script Small Ho Jati Hai |

For Example– Jyada tar Website Main Header.php And Footer.php Same Hote Hai Or Keval ContentArea.php Change Hota Rahta Hai. Isliye Developer Kiya Karta Hain Header.php Or Footer.php Ki Different File Create Kar Leta Hain Or Fir Use Include Or require Function Ki Help Se Header.php Or Footer.php Ko ContentArea.php Files Main Add Kar Deta Hain. Jisse Header Code Or Footer Code Ko Content Area File Mai Bina Jyada Code Likhe Website Show Jati Hai|

PHP Include Function In Hindi

include() Function in PHP Se External PHP file ko Kisi PHP file Me Istemal Kiya Jata Hain | include() Function in Hindi Mai Jis External PHP file Ko Include Karna Hain Us File Ke Name Ke Sath Unka Path Dena Padta Hain | Path Ko Aap double(” “) quote ya single (‘ ‘) quote Mai De Sakte Hain |

Syntax:

// include html file 
<?php include"path_or_filename"; ?>     or
<?php include'path_or_filename'; ?> 

// include php file  
include"path_or_filename";    or
include'path_or_filename';

Ab Ham Header.php or Footer.php File ko Alag Alag Karke Create Karte Hain Or Fir In File Ko ContentArea.php File Mai Include Karte Hain |

Example – Header.php

<?php
  echo "Header File";
?>

Example – Footer.php

<?php
  echo "Footer File";
?>

Example – ContentArea.php

<?php
include'Header.php';
echo "<br>";
echo "Content Area";
echo "<br>";
include'Footer.php';  
?>

Output:

Header File
Content Area
Footer File

Aap Upper Output Dekh Sakte Hai Hamne Header.php or Footer.php ko ContentArea.php Mai Add Kar Diya Hain |

Friends Agar Aap File Include Karte Ho Or Wo File Ka Name Wrong Ho Jata Hai Ya File Exits Nhi Karti Hai To Include File Ka Name Ka Error Show Karenga Or Uski Bad Ki File Ka Content Show Hoga |

Example:

<?php
include'Header_nhi_hai.php';
echo "<br>";
echo "Content Area";
echo "<br>";
include'Footer.php';  
?>

Output:

PHP require Function In Hindi

require() Function in PHP Se External PHP file ko Kisi PHP file Me Istemal Kiya Jata Hain | require() Function in Hindi Mai Jis External PHP file Ko require Karna Hain Us File Ke Name Ke Sath Unka Path Dena Padta Hain | Path Ko Aap double(” “) quote ya single (‘ ‘) quote Mai De Sakte Hain |

require function, include function ki Tarah Hota hai. Lekin include function file Miss Hone Par Error Show Karta Hain. Lekin require function file ko compilation error message Show Kar Deta Hai or Baki content ko Bhi show se Rok Deta hai |

Syntax:

// include html file 
<?php require"path_or_filename"; ?>     or
<?php require'path_or_filename'; ?> 

// include php file  
require"path_or_filename";    or
require'path_or_filename';

Ab Ham Header.php or Footer.php File ko Alag Alag Karke Create Karte Hain Or Fir In File Ko ContentArea.php File Mai require Karte Hain |

Example – Header.php

<?php
  echo "Header File";
?>

Example – Footer.php

<?php
  echo "Footer File";
?>

Example – ContentArea.php

<?php
require'Header.php';
echo "<br>";
echo "Content Area";
echo "<br>";
require'Footer.php';  
?>

Output:

Header File
Content Area
Footer File

Aap Upper Output Dekh Sakte Hai Hamne Header.php or Footer.php ko ContentArea.php Mai Add Kar Diya Hain |

Friends Agar Aap File require Karte Ho Or Wo File Ka Name Wrong Ho Jata Hai Ya File Exits Nhi Karti Hai To require File Ka Name Ka compilation error message show Karenga Or Uski Bad Ki File Ka Content Show Hone se Rok Dega |

Example:

<?php
require'Header_nhi_hai.php';
echo "<br>";
echo "Content Area";
echo "<br>";
require'Footer.php';  
?>

Output:

Yadi Aapne  HTML Full Course  And CSS Full Course Nhi Read Kiya Hai To Aap Vah Bhi Read Kar Sakte Hai |

Leave a Reply

Your email address will not be published. Required fields are marked *