PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Re: [PHP] Include fails when "./" is in front of file name
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: [PHP] Include fails when "./" is in front of file name

Réponse
 
LinkBack Outils de la discussion
Vieux 07/04/2008, 17h10   #1
Wolf
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Include fails when "./" is in front of file name


---- Daniel Brown <parasane@gmail.com> wrote:
> On Mon, Apr 7, 2008 at 11:52 AM, Wolf <lonewolf@nc.rr.com> wrote:
> >
> > Noah,
> >
> > Looks like you need to be deciding on whether or not you are on windoze or *Nix.
> >
> > If on Windoze, your include path is \
> > If on *Nix, your include path is /
> >
> > Notice the direction of the slashes and code appropriately in all locations.

>
> Actually, PHP is "smart" enough to allow both on Windows.
> Otherwise, everyone would need to update their code for each different
> system, which destroys PHP's cross-platform nature.
>
> --


I've heard that to be the case, but sometimes it's not just the PHP but the underlying server doing the serving...

At any rate, how hard is it to convert slashes if you have to convert your OSs if you use a managed include file or keep the includes directive in the .htaccess folder.

YMMV, but I always just change them to be on the safe side, but that's just how I roll...

Wolf
  Réponse avec citation
Vieux 07/04/2008, 17h14   #2
Stut
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Include fails when "./" is in front of file name

Wolf wrote:
> ---- Daniel Brown <parasane@gmail.com> wrote:
>> On Mon, Apr 7, 2008 at 11:52 AM, Wolf <lonewolf@nc.rr.com> wrote:
>>> Noah,
>>>
>>> Looks like you need to be deciding on whether or not you are on windoze or *Nix.
>>>
>>> If on Windoze, your include path is \
>>> If on *Nix, your include path is /
>>>
>>> Notice the direction of the slashes and code appropriately in all locations.

>> Actually, PHP is "smart" enough to allow both on Windows.
>> Otherwise, everyone would need to update their code for each different
>> system, which destroys PHP's cross-platform nature.
>>
>> --

>
> I've heard that to be the case, but sometimes it's not just the PHP but the underlying server doing the serving...
>
> At any rate, how hard is it to convert slashes if you have to convert your OSs if you use a managed include file or keep the includes directive in the .htaccess folder.
>
> YMMV, but I always just change them to be on the safe side, but that's just how I roll...


If you're worried about is use DIRECTORY_SEPARATOR rather than
hard-coding it. Writing portable code is not difficult in PHP.

-Stut

--
http://stut.net/
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h28.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09508 seconds with 10 queries