|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Where does the extra slah come from?[newbie]
I have a snippet of my php code, looking like this:
$dir=ereg_replace("index.php","",$PHP_SELF).$cat."/bilder/"; ?> <body><div align=center> <?=returnimg($dir.$img); ?> But no image is returned, because there's an extra slash. I.e http://www.domain.com//xxx/yyy/bilder/picture.jpg WHY??!?!?? Please, please, help me... /Awa |
|
#2
|
|||
|
|||
|
What is the value of $cat?
Does it begin with /? |
|
#3
|
|||
|
|||
|
$cat
$cat is only the directory containing the directory with the picture, in my example yyy.
Or, to make it more visible, like this: URL$cat/bilder/picture.jpg The xxx directory is where the index.php file is found, containing the code. URL is the url to the homepage, but I haven't written that anywhere in the page, so the extra slash must originate from that code... Blasted... *pulling my hair in desperation* The problem lies in the fact that I have my page hosted in the subdirectory /~rrr/. If I had had the page on my own domain, the extra slash wouldn't have mattered, as the page still would have been found... But with two slashes before my homepage directory, my page isn't recognized. |
|
#4
|
|||
|
|||
|
Why don't you try something like:
PHP Code:
I don't currently have access to a box running PHP so can't test it, but you may like to use something along these lines. Matt |
|
#5
|
||||
|
||||
|
$PHP_SELF usually contains a preceding slash, I believe. So if you're replacing only "index.php" and not "/index.php," you'll have the terminal slash from the URL followed by the preceding slash from $PHP_SELF for a total of two consecutive slashes.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Where does the extra slah come from?[newbie] |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|