我正在尝试使用 php include 来包含页面。
问题是我需要包含一个查询字符串,并且包含调用失败,即:
<?php include($urlroot.'/discounts/relatedcontent.php');?>
成功检索该页面,但是当我尝试
时<?php include($urlroot.'/discounts/relatedcontent.php?tag=health');?>
php包含调用失败。
为什么我该怎么做呢?我需要将tag的值传递给$urlroot.'/discounts/relatedcontent.php'
页面
答案 0 :(得分:0)
include
参数不能GET
文件路径。因为include
按原样获取文件名,并且无法处理?tag=health
之类的任何规则。取而代之的是,您需要分离此脚本的一部分,在获取?tag=health
时生成,并单独包含它。