require_once();参数错误无效

时间:2012-12-07 06:25:58

标签: php

  

可能重复:
  failed to open stream: Invalid argument

// 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.'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');

每当我试图通过在我的地址栏中输入localhost / photo_gallery / public / admin / index.php来运行此代码。它将显示如下错误:

  

警告:require_once(\ C:\ wamp \ www \ photo_gallery \ includes \ config.php):   无法开放流:无效的参数   第16行的C:\ wamp \ www \ photo_gallery \ includes \ initialize.php。

     

致命错误:require_once():无法打开所需的'\ C:\ wamp \ www \ photo_gallery \ includes \ config.php'(include_path ='。; C:\ php \ pear')   在第16行的C:\ wamp \ www \ photo_gallery \ includes \ initialize.php

请告诉我该怎么办?我是一个初学者创业网站设计师,我正陷入这个致命的错误。

1 个答案:

答案 0 :(得分:0)

DS在以下行中是额外的:

define('SITE_ROOT',DS。'C:'。DS.'wamp'.DS.'www'.DS.'photo_gallery');

请删除它以便

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

使用define而不是