简体   繁体   English

PHP include include include不起作用

[英]PHP include within include not working

I have the following setup: 我有以下设置:

index.php (in root) is including results.php (also in root) index.php(在根目录下)包括results.php(也在root内)

<?php include("results.php"); ?>

Within results, I'm including another file using the URI (which I set with a variable) to get the correct directory, since I'm using rewrites to make the "results page" different depending on user input. 在结果中,我将包含另一个使用URI(使用变量设置)的文件来获取正确的目录,因为我正在使用重写功能使“结果页面”根据用户输入而有所不同。

So, inside results.php: 因此,在results.php内部:

<?php include($website['uri'] . 'elements/keywords.php'); ?>

For reference, when I try to make the above a link, it goes through. 作为参考,当我尝试使以上链接通过时,它将通过。

<a href="<?php echo $website['uri']."elements/keywords.php"; ?>">Test</a>

I can click the link and there is no problem, but absolutely nothing happens when I try to include it. 我可以单击链接,没有问题,但是当我尝试包含它时,绝对没有任何反应。 My results.php is included inside index.php just fine. 我的results.php包含在index.php中就好了。

Can anybody offer some tips to get this working? 有人可以提供一些技巧来使它正常工作吗?

UPDATE: $website['uri'] is set and is ALWAYS "/seo-project/", which is the directory I'm working inside (where index.php is). 更新:$ website ['uri']已设置且始终为“ / seo-project /”,这是我在其中工作的目录(index.php在其中)。 Replacing the variable with the relative path does nothing but still works with the link. 用相对路径替换变量不会执行任何操作,但仍可用于链接。

Don't use BASE URL, instead use Physical path. 不要使用BASE URL,而要使用物理路径。 Remove the $website['uri'] part from the path 从路径中删除$ website ['uri']部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM