我有一个文件位于:
/Library/WebServer/Documents/wordpress/wp-content/themes/directorypress/sidebar-left-big.php
我在子目录中有另一个文件:
/Library/WebServer/Documents/wordpress/wp-content/themes/directorypress/template_directorypress/_gallerypage.php
在 _gallerypage.php 我有 php 包括:
<?php include('../sidebar-left-big.php'); //left sidebar, category navigation and ads ?>
我得到的错误:
Warning: include(../sidebar-left-big.php) [function.include]: failed to open stream: No such file or directory in /Library/WebServer/Documents/wordpress/wp-content/themes/directorypress/template_directorypress/_gallerypage.php on line 9
Warning: include() [function.include]: Failed opening '../sidebar-left-big.php' for inclusion (include_path='.:') in /Library/WebServer/Documents/wordpress/wp-content/themes/directorypress/template_directorypress/_gallerypage.php on line 9
在我看来,我做的一切都是正确的。
我认为问题可能是 _gallerypage.php 是通过包含在另一个文件中加载的,因此 ../ 相对于该文件会导致错误。但是错误并没有说明它认为 sidebar-left-big.php 的路径在哪里。