English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I know how to grab the URL but how do i detect just the directory name and get that asigned to a var... I started with pathinfo() but im stuck now

for example "abc/efg/index.php"

how do I get "efg"

2006-07-07 07:47:07 · 2 answers · asked by Trance K 2 in Computers & Internet Programming & Design

2 answers

an easy way is just to use explode("/",$url);

ignore the last value and all the rest are directories.

2006-07-07 07:51:11 · answer #1 · answered by John J 6 · 0 0

You can use a function in PHP called "is_dir" from there you can use different string functions like pregmatch to pull what you need. Check out the link below for more info or post this question on http:prydain.futurecis.com/Forums. Hope this helps.

http://www.php.net/manual/en/function.is-dir.php

2006-07-07 14:55:33 · answer #2 · answered by William 2 · 0 0

fedest.com, questions and answers