Jump to content


Photo

\ instead of /


  • Please log in to reply
3 replies to this topic

#1 pucker22

pucker22
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 30 August 2006 - 03:14 PM

Hey all, recently i've been having some hazzle using a php script that uses / for my script directory, however as I am on a Windows server it has to be set to \

When I change the / to \ in MacromediaDreamweaverMX08 The text colour that was red will now be black, so therefore the script wont work right.

Basically my code is :-

define('PEAR_DIR', 'C:\Inetpub\vhosts\domain.com\httpdocs/libs/Pear/');

however I really need it to be straight forward to :-

define('PEAR_DIR', 'C:\Inetpub\vhosts\domain.com\httpdocs\libs\Pear\');

notice how I want it to be \ ?

How would I go about doing this, what do I need to add to the end of it to make it work, because the ' only works with / at the end..

I hope this makes somewhat sence.... Thanks!

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 August 2006 - 03:16 PM

Use two \ (\\) for defining windows paths. It is becuase the \ is escaping the quote at the end of the define statement. Using \\ will helpl stop this.

#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 30 August 2006 - 03:17 PM

you need to escape the backslash because PHP thinks you're trying to escape the quote with it:
<?php
define('PEAR_DIR', 'C:\\Inetpub\\vhosts\\domain.com\\httpdocs\\libs\\Pear\\');
?>

i've escaped all of them, just for safety. try that out and see what it does.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#4 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 31 August 2006 - 12:42 AM

realpath() will be of use for cross compatability.

<?php define('PEAR_DIR', realpath('libs/Pear')); ?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users