![]() |
split an url
hi guys and gals
I think I am getting tired, I have an url in a database called the following: ../../file.extention I need to change that url to: ../file.extention I can't for the life of me figure it... I know I am stupid... I need to split, but I cant get it to work All help appreciated Xallow |
If you're trying to remove it from the database, you could do:
Code:
update tablename set path=replace(path,'../../','../'); If you are trying to remove it from some data, and you knew it was just the first three characters, Code:
$path = substr('../../file.extension',3); Code:
$path = preg_replace('/^..\//','','../../file.extension'); Another possibility is parse_url, but, I am not sure how it would react. If you knew that you wanted to pull the first 'section' at the first /, you could do something like Code:
$arr = (explode('/','../../file.extension')); |
Thanks, that worked, I have another question though.
Is it not possible to get access to a folder on my server from my website? I created a folder on the server where my domains are hosted to use the files from that folder on all my sites, but when I link to those files I get nothing. Do I need to set some permission thingies or something? |
Depends on the server config. There are so many possible answers and configurations that you might need to check with your host. They could be restricting opens, you might be served from two different fileservers, so, while the path may look identical, you could be on two totally different paths, or many other possibilities.
You might do something like: Code:
echo getcwd(); |
All times are GMT -4. The time now is 06:40 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc