Digunakan untuk memeriksa Absolute Path dari parameter yang diberikan.
Syntax:
realpath(‘path_yang_diuji’);
Nilai yang dikembalikan
Jika sukses maka akan menghasilkan absolute path dari path yang diuji.
Jika gagal maka akan menghasilkan FALSE.
Dan akan menghilangkan semua symbolic link('/ ./, '/ ../, '/') yang biasanya ada di server (contoh: "/home/something/somewhere/htdocs/file/../app/controller/../../core/something) dan anda akan mendapatkan path sesungguhnya tanpa ada ../ dan lain-lain
Contoh:
Buatlah satu file PHP bernama realpath.php dengan kode seperti dibawah ini:
Lalu saya simpan dalam direktori C:\xampp\htdocs\php.
Hasil:
Buka file realpath.php dengan browsermu maka akan menghasilkan tulisan seperti dibawah ini:
C:\xampp\htdocs\php
Ketarangan:
Tanda ‘.‘ ini adalah relative path yang mewakili direktori dimana tanda titik ini berada yaitu direktori ‘C:\xampp\htdocs\php’
Jadi fungsi realpath() pada kode diatas menghasilkan absolute path dari tanda ‘.‘ yaitu direktori ‘C:\xampp\htdocs\php’
Contoh Lain:
Buatlah satu file PHP bernama real.php dengan kode seperti dibawah ini:
Lalu saya simpan dalam direktori C:\xampp\htdocs\php.
Hasil:
Buka file real.php dengan browsermu maka akan menghasilkan tulisan seperti dibawah ini:
Well, the way they make shows is, they make one show. That show's called a pilot. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows.
Like you, I used to think the world was this great place where everybody lived by the same standards I did, then some kid with a nail showed me I was living in his world, a world where chaos rules not order, a world where righteousness is
not rewarded. That's Cesar's world, and if you're not willing to play by his rules, then you're gonna have to pay the price.
You think water moves fast? You should see ice. It moves like it has a mind. Like it knows it killed the world once and got a taste for murder. After the avalanche, it took us a week to climb out. Now, I don't know exactly when we turned on
each other, but I know that seven of us survived the slide... and only five made it out. Now we took an oath, that I'm breaking now. We said we'd say it was the snow that killed the other two, but it wasn't. Nature is lethal but it doesn't
hold a candle to man.
You see? It's curious. Ted did figure it out - time travel. And when we get back, we gonna tell everyone. How it's possible, how it's done, what the dangers are. But then why fifty years in the future when the spacecraft encounters a black
hole does the computer call it an 'unknown entry event'? Why don't they know? If they don't know, that means we never told anyone. And if we never told anyone it means we never made it back. Hence we die down here. Just as a matter of
deductive logic.
Tidak ada komentar:
Posting Komentar