Jump to content

Recommended Posts

How can I fix this?

 

File Location (where directory.php is located):

C:\xampp\htdocs\hfmw\chapter7\tartans

 

PHP code:

define('TARTAN_DOC_ROOT', '/' .  ltrim(substr(dirname(__FILE__), strlen($_SERVER['DOCUMENT_ROOT'])), '/'));

define('PUBLIC_TARTAN_DIR', rtrim(TARTAN_DOC_ROOT, '/') . '/tartans/');

 

directory.php:

echo PUBLIC_TARTAN_DIR . '<br />';

 

Results:

/\hfmw\chapter7/tartans/

Link to comment
https://forums.phpfreaks.com/topic/266470-fixing-double-slashes-in-windows-path/
Share on other sites

Try using the PHP constant: DIRECTORY_SEPARATOR instead of using "/". The constant contains the appropriate value (forward-slash or back-slash) for the operating system.

 

DavidAM,

It's not working. I am using XAMPP. I am getting tons of error messages.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.