Jump to content

Archived

This topic is now archived and is closed to further replies.

pucker22

\ instead of /

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
you need to escape the backslash because PHP thinks you're trying to escape the quote with it:
[code]
<?php
define('PEAR_DIR', 'C:\\Inetpub\\vhosts\\domain.com\\httpdocs\\libs\\Pear\\');
?>
[/code]

i've escaped all of them, just for safety. try that out and see what it does.

Share this post


Link to post
Share on other sites
realpath() will be of use for cross compatability.

[code=php:0]<?php define('PEAR_DIR', realpath('libs/Pear')); ?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.