Click here to Skip to main content
15,867,488 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
Questionsimulated annealing for distribution in php Pin
wahyu oke14-Jun-11 9:58
wahyu oke14-Jun-11 9:58 
QuestionI urgently need an online exam or test script Pin
E.O.Akinyemi13-Jun-11 13:53
E.O.Akinyemi13-Jun-11 13:53 
AnswerRe: I urgently need an online exam or test script Pin
walterhevedeich16-Jun-11 15:35
professionalwalterhevedeich16-Jun-11 15:35 
AnswerRe: I urgently need an online exam or test script Pin
Glen Villar16-Jun-11 18:32
Glen Villar16-Jun-11 18:32 
AnswerRe: I urgently need an online exam or test script Pin
cjoki17-Jun-11 11:04
cjoki17-Jun-11 11:04 
AnswerRe: I urgently need an online exam or test script Pin
thatraja8-Jul-11 17:05
professionalthatraja8-Jul-11 17:05 
QuestionBreak down URL Pin
djhankypark11-Jun-11 2:46
djhankypark11-Jun-11 2:46 
AnswerRe: Break down URL Pin
Graham Breach11-Jun-11 5:37
Graham Breach11-Jun-11 5:37 
There are several ways to do it, so these are the most simple options that I can think of.

1. Use dirname[^] to get the parent directory name (if you are sure that the URL always contains the filename):
<?php
$url = $_SERVER['REQUEST_URI'];
$dir = trim(dirname($url), '/');


2. Use explode[^] to break the path into an array:
<?php
$url = $_SERVER['REQUEST_URI'];
$parts = explode('/', trim($url, '/'));
$dir = $parts[0];


I've used trim[^] in both of these to remove leading and trailing '/' characters.
GeneralRe: Break down URL Pin
djhankypark11-Jun-11 6:42
djhankypark11-Jun-11 6:42 
Question[SOLVED] Keep the page position? [modified] Pin
Joan M9-Jun-11 3:33
professionalJoan M9-Jun-11 3:33 
AnswerRe: Keep the page position? Pin
all_in_flames9-Jun-11 3:58
professionalall_in_flames9-Jun-11 3:58 
GeneralRe: Keep the page position? Pin
Joan M9-Jun-11 4:20
professionalJoan M9-Jun-11 4:20 
GeneralRe: Keep the page position? Pin
all_in_flames9-Jun-11 4:25
professionalall_in_flames9-Jun-11 4:25 
GeneralRe: Keep the page position? Pin
Joan M9-Jun-11 5:06
professionalJoan M9-Jun-11 5:06 
GeneralRe: Keep the page position? Pin
Joan M9-Jun-11 5:14
professionalJoan M9-Jun-11 5:14 
GeneralRe: Keep the page position? Pin
Joan M9-Jun-11 4:38
professionalJoan M9-Jun-11 4:38 
GeneralRe: Keep the page position? Pin
Joan M9-Jun-11 5:16
professionalJoan M9-Jun-11 5:16 
AnswerRe: Keep the page position? Pin
Graham Breach9-Jun-11 5:06
Graham Breach9-Jun-11 5:06 
GeneralRe: Keep the page position? Pin
Joan M9-Jun-11 5:18
professionalJoan M9-Jun-11 5:18 
GeneralRe: Keep the page position? Pin
Graham Breach9-Jun-11 8:15
Graham Breach9-Jun-11 8:15 
QuestionRunning .NET app on Linux Pin
AmbiguousName9-Jun-11 3:01
AmbiguousName9-Jun-11 3:01 
AnswerRe: Running .NET app on Linux Pin
Groulien9-Jun-11 4:28
Groulien9-Jun-11 4:28 
GeneralRe: Running .NET app on Linux Pin
Eddy Vluggen19-Aug-11 6:54
professionalEddy Vluggen19-Aug-11 6:54 
AnswerRe: Running .NET app on Linux [modified] Pin
anthonybates11-Jul-11 18:14
anthonybates11-Jul-11 18:14 
AnswerRe: Running .NET app on Linux Pin
Ni740826-Jul-11 2:17
Ni740826-Jul-11 2:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.