root filepath reference in php
Posted: Wed Mar 03, 2010 4:56 pm
Is php’s filepath naming convention different than html’s for "/[rootfolder]"?
With picture1.jpg and menubar.php in the same “resources” folder, this line in anyfile.php calls the picture file just fine --
-- but the very next line --
doesn’t call the menubar.php file (doesn’t do anything).
Either of the following variations does work, if I put menubar.php respectively up one level or down one level in folder “nav” --
-- which would be okay, except that I would like to use the root-folder-based references, as with the picture file example here.
Does php not use the “/” convention for specifying the root folder, as html does?
Thank you.
With picture1.jpg and menubar.php in the same “resources” folder, this line in anyfile.php calls the picture file just fine --
Code: Select all
<img src="/resources/picture1.jpg">Code: Select all
<?php include("/resources/menubar.php"); ?>doesn’t call the menubar.php file (doesn’t do anything).
Either of the following variations does work, if I put menubar.php respectively up one level or down one level in folder “nav” --
Code: Select all
<?php include("../menubar.php"); ?>Code: Select all
<?php include("nav/menubar.php"); ?>Does php not use the “/” convention for specifying the root folder, as html does?
Thank you.