Home  >  Article  >  Backend Development  >  php_DIRECTORY_SEPARATOR 和 PATH_SEPARATOR

php_DIRECTORY_SEPARATOR 和 PATH_SEPARATOR

WBOY
WBOYOriginal
2016-06-23 13:39:22852browse

DIRECTORY_SEPARATOR 和 PATH_SEPARATOR

DIRECTORY_SEPARATOR:目录分隔符,linux上就是’/’    windows上是’\’

 

PATH_SEPARATOR:路径分隔符,include多个路径使用,在win下,当你要include多个路径的话,你要用”;”隔开,但在linux下就使用”:”隔开的。

 

=================================================

 

 

zendframework include 设置 index.php

 

set_include_path('.' . PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/'

. PATH_SEPARATOR . './application/lib/'

. PATH_SEPARATOR . get_include_path());

 

PATH_SEPARATOR是一个常量,在Linux系统中是一个" : "号,Windows上是一个" ; "号。所以编写程序时最好用常量 PATH_SEPARATOR 代替,否则如果系统从linux移植到win系统或反过来移植会出错!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:[PHP] 浅谈PHP之美Next article:PHP5.5+集成OPcache