带有PHP的URL querystring包括 [英] URL querystring with a php include

查看:239
本文介绍了带有PHP的URL querystring包括的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在页面的选项卡中包含要输出的文件.该文件本身将正常运行,但是当我尝试向其中添加所需的查询字符串时,它给我一个无法打开流:没有这样的文件或目录"的错误.

I'm trying to include a file to output in a tab on a page. The file itself will pull up just fine, but when I try to add the required querystring to it, it gives me a "failed to open stream: No such file or directory" error.

我只尝试了一个直接包含,并尝试将querystring设置为变量.这就是我现在的位置.

I've tried just a straight include and tried setting the querystring as a variable. Here's where I'm at right now.

$listingVars = '?mls=' . $_REQUEST['mlid'] . '&lid=0&v=agent';include("agentview.php$listingVars");

有人成功做到了吗?

推荐答案

您不能在include()中包含查询字符串.

You can't include a query string in an include().

假设这是本地脚本,则可以使用:

Assuming this is a local script, you could use:

$_REQUEST['mls'] = $_REQUEST['mlid'];
$_REQUEST['lid'] = 0;
$_REQUEST['v'] = 'agent';
include("agentview.php");

如果它是另一台服务器上的远程脚本,请不要使用include.

if it's a remote script on a different server, don't use include.

这篇关于带有PHP的URL querystring包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆