[英]Include and _SERVER['REQUEST_URI']
I have 2 pages. 我有2页。 file2.php is generating links, depending on which page you are on the website. file2.php正在生成链接,具体取决于您在网站上的页面。
file1.html file1.html
<!--#include virtual="file2.php" -->
<a href="<?php echo $link ?>">Link</a>
file2.php file2.php
$q = $_SERVER['REQUEST_URI'];
if (preg_match('/\bSOMETHING\b/i', $q)) {
$link = "whateverpage.php";
//...
My problem is that on my dev server, I'm getting $q=file1.html but on my live server, $q=file2.php. 我的问题是,在我的开发服务器上,我得到了$ q = file1.html,但是在我的活动服务器上,我得到了$ q = file2.php。 Any idea why I'm getting 2 differents values? 知道为什么我会得到2个差值吗?
If the files, paths, etc are exactly alike, you might compare the results of phpinfo(); 如果文件,路径等完全相同,则可以比较phpinfo()的结果; on each machine. 在每台机器上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.