Tolong pilih kategori sesuai, jenis posting (diskusi atau bukan) dan sertakan tag/topik yang sesuai seperti komputer, java, php, mysql, dll. Promosi atau posting tidak pada tempatnya akan kami hapus!
- Bagi Anda yang ingin mendaftar, baca link berikut:
http://diskusiweb.com/discussion/50491/how-to-registrasi-diskusiweb-com-baca-ini-terlebih-dahulu
- Cara menyisipkan kode program supaya tampil rapi dan terformat dengan baik di diskusiweb.com: http://www.diskusiweb.com/discussion/50415/cara-menyisipkan-kode-program-di-diskusiweb-com
- Cara posting gambar/image di post Anda: http://www.diskusiweb.com/discussion/47345/cara-menyisipkan-menyertakan-image-pada-posting/p1

Bagaimana cara include file yang berada dalam direktori yang berbeda ?

Saya mempunyai file index.php, dan saya menginclude header.php, home.php, dan footer.php ke dalam index.php;
(sedangkan file "header.php", "home.php" dan "footer.php" berada dalam folder "data")
namun saya mengalami masalah error :


Warning: include(/data/header.php): failed to open stream: No such file
or directory in /home/u987361841/public_html/index.php on line 8

Warning: include(): Failed opening '/data/header.php' for inclusion
(include_path='.:/usr/lib/php') in /home/u987361841/public_html/index.php
on line 8

Warning: include(/data/home.php): failed to open stream: No such file or
directory in /home/u987361841/public_html/index.php on line 9

Warning: include(): Failed opening '/data/home.php' for inclusion
(include_path='.:/usr/lib/php') in /home/u987361841/public_html/index.php
on line 9

Warning: include(/data/footer.php): failed to open stream: No such file
or directory in /home/u987361841/public_html/index.php on line 10

Warning: include(): Failed opening '/data/footer.php' for inclusion
(include_path='.:/usr/lib/php') in /home/u987361841/public_html/index.php
on line 10


Isi file index.php :

<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
<link rel="stylesheet" type="text/css" href="/css/submenu.css">
<body>
<?php
include "/data/header.php";
include "/data/home.php";
include "/data/footer.php";
?>
</body>
</html>

Pertanyaan :
Bagaimana cara mengatasi error tersebut?

Mohon bantuannya,
Arigato^^
Tagged:

Comments

Sign In or Register to comment.