>  기사  >  백엔드 개발  >  php set_include_path include 疑惑,该如何处理

php set_include_path include 疑惑,该如何处理

WBOY
WBOY원래의
2016-06-13 13:50:22679검색

php set_include_path include 疑惑
1.假设在 include/目录里有config.php文件
2.如果用set_include_path('../include')后
3.想再index.php用config的东西只要include('config.php') 就可以了。

疑问:那我在其他页面只需include('config.php'),还是set_include_path('../include')在include('config.php')呢?
他不可以跨页面,或者跨目录吗?


------解决方案--------------------
还得加上:set_include_path('../include'); 前提是其他文件必须和你的index.php文件在同级目录。
------解决方案--------------------
没用过zendframework ,你试试不就知道了。。 可能可以呢。
------解决方案--------------------

探讨

哦好的 谢谢 那zendframework 里也是这样的吗? zf里好像index.php 中include之后 其他就不需要了 像这种写法 load::class 就加载了
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.