0

I've a site that runs on my local machine. These rows are ok when I'm on OSX. While on windows generates errors:

set_include_path ( get_include_path () . ':' . dirname ( __FILE__ ) . '/../lib/propel/runtime/lib/' );
set_include_path ( get_include_path () . ':' . dirname ( __FILE__ ) . '/../lib/smarty/libs/' );
set_include_path ( get_include_path () . ':' . dirname ( __FILE__ ) . '/../classes/' );
set_include_path ( get_include_path () . ':' . dirname ( __FILE__ ) . '/../classes/ORM/' );

This is the error

Fatal error: require_once(): Failed opening required 'Propel.php' (include_path='.:C:/wamp/www/emporio-rossi/conf/:C:\wamp\www\emporio-rossi\wapp/../lib/propel/runtime/lib/:C:\wamp\www\emporio-rossi\wapp/../lib/smarty/libs/:C:\wamp\www\emporio-rossi\wapp/../classes/:C:\wamp\www\emporio-rossi\wapp/../classes/ORM/') in C:\wamp\www\emporio-rossi\wapp\conf.inc.php on line 33

Propel.php is located in the firs URI (set_include_path ( get_include_path () . ':' . dirname ( __FILE__ ) . '/../lib/propel/runtime/lib/' );)

4

1 回答 1

2

Windows uses ; as a path separator whereas nix (including OSX) uses :.

The answer is to use the PATH_SEPARATOR constant:

set_include_path ( get_include_path () . PATH_SEPARATOR . dirname ( __FILE__ ) . '/../lib/propel/runtime/lib/' );

From the docs:

Making use of the PATH_SEPARATOR constant, it is possible to extend the include path regardless of the operating system.

于 2014-01-16T15:24:04.303 回答