문제

포함 경로를 설정하는 방법을 알고 있습니다.

set_include_path('/path');

그러나 여러 개의 포함 경로를 어떻게 설정할 수 있습니까? 예를 들어 : 두 개의 다른 디렉토리로.

도움이 되었습니까?

해결책

콜론으로 분리하십시오 (:).

set_include_path("/some/dir:/other/dir:.");

더 많은 정보 php.net.

다른 팁

크로스 플랫폼 방식으로이를 수행하려면 사용하십시오. path_separator 끊임없는:

set_include_path('/my/path' . PATH_SEPARATOR . '/my/other/path');

참고 : 포함 경로를 설정할 수도 있습니다. php.ini 또는 Apache Vhost 구성에서.

추가 참조를 위해 : set_include_path ()의 PHP 문서

수많은 경로를 설정합니다

여기에 방법이 있습니다 플랫폼 독립 수많은 값 배열의 경로를 설정하는 방법 :

$paths = array(
    'path/one/',
    'path/two/',
    'path/three/'
 );

set_include_path(get_include_path() . PATH_SEPARATOR . implode(PATH_SEPARATOR, $paths));

이것은 나를 위해 작동합니다 :-)

ini_set("include_path", ".;C:\wamp\bin\php\php5.3.13\pear;.;C:\wamp\bin\php\php5.3.13\Zend\library");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top