/    Sign up×
Community /Pin to ProfileBookmark

pathinfo not working

i have a php page that uses pathinfo() so I can use urls like http://www.my_site.com/browse.php/cat_id/1.html.

I do a str_replace to remove the “.html” and I end up with cat_id=1.

The pathinfo works fine on one host using php 4.3.4 but not on one using 4.2.3. When I mouseover the link, it shows http://www.my_site.com/browse.php/cat_id/1.html but I still get an 404 error .

pathinfo() came in with php 4.0.

Any ideas?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryMay 10.2004 — Can you post your code? It's possible there's something else causing the problem.

Adam
Copy linkTweet thisAlerts:
@esmauthorMay 10.2004 — it does run on one site but not the other. I am going to try a third site later. here is the pathinfo code



[code=php]<?php
// initialiazation section - do not change
if(isset($PATH_INFO)) {
$PATH_INFO = str_replace(".html","",$PATH_INFO);
$vardata = explode('/', $PATH_INFO);
$num_param = count($vardata);
if ($num_param % 2 == 0) {
$vardata[] = '';
$num_param++;
}
for ($ij = 1; $ij < $num_param; $ij += 2) {
if (!empty($vardata[$ij]) AND !empty($vardata[$ij+1])) {
$$vardata[$ij] = addslashes($vardata[$ij+1]);
}
}
}
?>[/code]
×

Success!

Help @esm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...