Как использовать DIRECTORY_SEPARATOR для Windows

Я пытаюсь понять, почему я получаю эту ошибку.

**Warning: require_once(\C\wamp\www\PHP with MySQL Beyond the Basics\Chapter06\06_12_photo_gallery\includes\config.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\PHP with MySQL Beyond the Basics\Chapter06\06_12_photo_gallery\includes\initialize.php on line 16 Fatal error: require_once() [function.require]: Failed opening required '\C\wamp\www\PHP with MySQL Beyond the Basics\Chapter06\06_12_photo_gallery\includes\config.php' (include_path='.;C:\php5\pear') in C:\wamp\www\PHP with MySQL Beyond the Basics\Chapter06\06_12_photo_gallery\includes\initialize.php on line 16** 

Теперь вот код на странице index.php

 <?php require_once('../../includes/initialize.php'); if (!$session->is_logged_in()) { redirect_to("login.php"); } ?> <?php include_layout_template('admin_header.php'); ?> <h2>Menu</h2> </div> <?php include_layout_template('admin_footer.php'); ?> в <?php require_once('../../includes/initialize.php'); if (!$session->is_logged_in()) { redirect_to("login.php"); } ?> <?php include_layout_template('admin_header.php'); ?> <h2>Menu</h2> </div> <?php include_layout_template('admin_footer.php'); ?> 

Вот код страницы initialize.php:

 <?php // Define the core paths // Define them as absolute paths to make sure that require_once works as expected // DIRECTORY_SEPARATOR is a PHP pre-defined constant // (\ for Windows, / for Unix) defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_ROOT') ? null : define('SITE_ROOT', DS.'C'.DS.'wamp'.DS.'www'.DS.'PHP with MySQL Beyond the Basics'.DS.'Chapter06'.DS.'06_12_photo_gallery'); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); // load config file first require_once(LIB_PATH.DS.'config.php'); // load basic functions next so that everything after can use them require_once(LIB_PATH.DS.'functions.php'); // load core objects require_once(LIB_PATH.DS.'session.php'); require_once(LIB_PATH.DS.'database.php'); // load database-related classes require_once(LIB_PATH.DS.'user.php'); ?> 

Я не думаю, что это проблема разделителя каталогов: вы можете использовать как обратную, так и обратную косую черту в Windows.

Проблема здесь:

 \C\wamp\www\PHP with MySQL Beyond the Basics 

если у вас нет каталога с именем C в корневом пути на текущем диске, то, что вы действительно хотите,

 C:\wamp\www\PHP with MySQL Beyond the Basics 

Я думаю, вот как это работает для mw

 defined('SITE_ROOT') ? null : define('SITE_ROOT', 'C:'.DS.'wamp'.DS.'www'.DS.'photo_gallery');