Latest tutorial we know how to write php code. Now we will know create index.php file and write some php code.
First we open our text editor software. Take a new document. Write this code :
<?php
?>
This is php starting and ending tag.
We will save this file so press ctrl+S. We see save dialog box. Go to the C>xampp>htdoc folder. Here we create a new folder. So take a new folder and write a name. I write the folder name is "tute". Then open the folder and save the file. Write the file name is : index.php and select Save as type is "All types (*.*)".
Create index.php File and write code |
Again we write some code in index.php file. The code is :
<?php
echo "Hello World";
?>
Then save the file (ctrl+S). Now we go to the web browser. We write "localhost/tute" in address bar. Then presh enter. We see "Hello World" in our browser.
Show index.php file in browser |
The index.php automatically open in server, so we cannot write index.php in browser address bar. If we write "localhost/tute/index.php" our result is same.
Next tutorial we know What is Indentation and how it works.
No comments :
Post a Comment