子目录中的php怎么访问与网站根目录htdocs平行的目录

WBOY
Release: 2016-06-13 13:08:58
Original
945 people have browsed it

子目录中的php怎样访问与网站根目录htdocs平行的目录?
出于安全考虑,我将一个work.php放在了与网站根目录htdocs平行的一个目录myprog中,对于htdocs目录下的php页面,我可以在其中以

include "../myprog/work.php";

的方式调用work.php,但现在有一个test.php在htdocs/check子目录下,那么在test.php中该怎样调用work.php?

------解决方案--------------------
include "../../myprog/work.php";
------解决方案--------------------
include dirname(__FILE__) . '/../../myprog/work.php'
如上面

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template