5 Jan 2011

Perintah echo pada PHP

Pada artikel sebelumnya di sini, kita membahas cara membuat server web localhost. Nah pada kesempatan kali ini, mari kita coba dan pelajari cara menggunakan server web tersebut secara lebih maksimal, yaitu dengan mencobanya dengan membuat file PHP.
Langkah pertama adalah buat folder baru di dalam server localhost yang berlokasi di C:\XAMPP\htdocs (sesuai tempat penginstallan). Beri nama folder baru tersebut dengan “latihan”.
Kita akan membuatnya menggunakan notepad, karena merupakan software default bawaan dari windows. So, sobat-sobat pasti punya kan? Setelah program notepad terbuka, maka ketikanlah kode berikut di dalamnya.

<html>
<head><title>Web PHP Pertamaku</title></head>
<body>
<?php
echo "Tulisan Tanpa Variasi. <br>";
echo "<b>Tulisan Dengan Bold.</b><br>";
echo "<u>Tulisan Dengan Garis Bawah.</u>";
?>
</body>
</html>  
Setelah selesai mengetikan kode di atas, simpan dengan nama “pertama.php” di dalam folder “latihan” yang baru saja dibuat.
Ingat! Karena sobat menggunakan notepad, jadi harus perhatikan juga Save as type nya , ubah jadi All Files.
 latihan php
Setelah selesai menyimpannya, maka selanjutnya kita akses file tersebut dari browser kesayangan sobat. Buka browsernya lalu arahkan addressnya ke http://localhost/latihan/pertama.php dan lihat hasilnya.

PENJELASAN KODE

Setiap memulai kode PHP, harus kita awali dengan tanda <?php. Lalu di baris-baris kode berikutnya sobat sering melihat kata echo, kata ini sebenarnya adalah sebuah perintah PHP untuk mencetak kata ke layar browser. Kalau pada HTML kita bisa mengetikan secara langsung kodenya untuk ditampilkan ke layar browser, tapi kalau di PHP harus diawali dengan perintah echo terlebih dahulu.
echo "<b>Tulisan Dengan Bold.</b><br>";
Isi yang akan kita cetak, harus kita letakan di antara tanda petik. Selain itu kita juga bisa menambahkan kode HTML di dalamnya, pada hal ini kita tambahkan tag <b> yang fungsinya untuk mencetak tebal (bold). Dan jangan lupa setelah selesai setiap suatu perintah (statement) di dalam PHP harus kita beri tanda titik koma ( ; ).
Sekarang kita beralih ke alamat/URL pengaksesannya, yaitu http://localhost/latihan/pertama.php
http://localhost adalah URL untuk mengakses server local, lalu latihan/ adalah nama folder tempat kita menyimpan filenya. Sedangkan pertama.php adalah nama file yang akan kita akses.
Sekian dulu tutorial kali ini, sampai jumpa next time. Mudah-mudahan bisa bermanfaat bagi semua.
sumber: kolom tutorial
Nimbuzz Flooder Community (Flooder Manual Team)

Comments :

5 komentar to “Perintah echo pada PHP”

hidayat mengatakan...
on 

thanks ya bro

kally martin mengatakan...
on 

Facing non-working google authentication every now and then? Want to fix the error from the roots? In such case, dial Binance support phone number and take assistance from the well-experienced experts who know every element of Binance. The expert’s team will offer those solutions that are easy to implement and remember. You can reach out to the professionals by dialing the phone number or Binance Support Number dropping your queries on chat box or through an email. They always take user’s queries as their first priority and work from full-dedication.

jhon karter mengatakan...
on 

It’s quite difficult for the users to tackle the situation when their account gets hacked by any professional hacker. Have you ever been into the situation when you experience hacking incident? Well, despite the tight security, hackers due to their inventive tricks manage to steal the information in user’s account. To fix the hacking Blockchain Support NUmber situation, you can always feel free to call on Blockchain support number which is working 24/7 and one can ping on the number as per the need.

jhon parkar mengatakan...
on 

It’s quite difficult for the users to tackle the situation when their account gets hacked by any professional hacker. Have you ever been into the situation when you experience hacking incident? Well, despite the tight security, hackers due to their inventive tricks Gemini Support Number manage to steal the information in user’s account. To fix the hacking situation, you can always feel free to call on Gemini support number which is working 24/7 and one can ping on the number as per the need.

Unknown mengatakan...
on 

Facing non-working google authentication every now and then? Want to fix the error from the roots? In such case, dial Libra Coin support phone number and take assistance from the well-experienced experts who know every element of Libra Coin. The expert’s team will offer those solutions that are easy to implement and remember. You can reach out to the professionals by dialing the phone number or Libra Support Number dropping your queries on chat box or through an email. They always take user’s queries as their first priority and work from full-dedication.

Posting Komentar

jangan Lupa KomENT Y.....

 

Copyright © 2010 by Nimbuzz Flooder Community

design by xXx | Powered by Blogger