Sunday, March 20, 2011

HOW-TO-INCLUDE-FILE-PHP

Assalamualaikum and selamat sejahtera

Morning!!hope u in good condition or in happy mood...waaa its been a long.....time that i stop posting,huhu..whatever it is...let we start with the new technique that enable us to include a file by using a PHP code.Example,u got a php code and then u want to include some file that content php code too!!wow it sound something new!!ryte2??hahaha..shall we start...off we go!!!

so,we a file that named myFile.txt

inside myFile.txt type:

this is from myFile.txt

close myFile.txt.After that,here is PHP code:

<HTML>
<HEAD>
<TITLE>Include files</TITLE>
</HEAD>

<BODY>
<H3>Normal text here </H3>
This text written in HTML

<H3>Include File here</H3>

<?PHP include "myFile.txt" ; ?>

</ BODY>
</ HTML >

test it!!

okey,then edit myFile.txt.open it and change that text to be like this:


<?PHP

function PrintFromFile( ) {
print "This function from the myFile.php";
}


?>

then save n close it,go to code, search this line:

<?PHP include "myFile.txt" ; ?>  

change it,to be like this:

<?PHP include "myFile.txt" ;
PrintFromFile()
?>

explain:note that,inside the PHP code,we add the name of function that from included file that all.Okey run it!


N/NOTE:anything problem???

1 comment:

  1. Great thing the way you used to describe the thing is really nice and easy to understand.


    Thanks a lot for such a great post....


    .net Obfuscators

    ReplyDelete