2012-02-11 31 views
0

包括PHP文件,我安装并激活execPHP插上并在WordPress的TinyMCE的采用这种与execPHP

<?php echo "hello"; ?> 
<?php include ("/test/test.php") ?> 

我看到hello输出正确,但后来我看到这个错误;

警告:包括(/test/test.php)[]:未能打开流:在d没有这样的文件或目录:\主机\ 5291199 \ HTML \网站\ MAIN \可湿性粉剂内容\ plugins \ exec-php \ includes \ runtime.php(42):第3行的eval()'d代码

警告:include()[function.include]:打开'/test/test.php'失败(42):eval包含(include_path ='.; C:\ php5 \ pear')在D:\ Hosting \ 5291199 \ html \ sites \ Main \ wp-content \ plugins \ exec-php \ ()'d代码在线3

我知道肯定,/test/test.php存在!它有有效的PHP代码...

+2

只是为了确保,你有一个文件'd:\测试\ test.php'?第一个'/'使它在根目录中寻找它...... – JJJ 2012-02-11 18:40:56

回答

0

您必须使用完整路径

echo dir(__FILE__); // Find out in what folder you are 
include (dirname(__FILE__) . "/../test/test.php"); // then adjust to the location of the file from this path 
+0

如果你有PHP 5.3或更高版本,你可以使用'__DIR__'常量。如果你有一个旧的PHP版本,你应该使用dirname(__ FILE __)' 'dir(...)'返回一个'Directory'的实例 – remy 2012-02-11 18:55:09

+0

对不起,我的意思是dirname :-) tnx – Richard 2012-02-11 18:59:08

+0

dirname(__ FILE__)返回D:\ Hosting \ 5291199 \ html \ sites \ Main \ wp-content \ plugins \ exec-php \包含 – 2012-02-11 23:20:48