首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Simpledom Interurl变量

Simpledom Interurl变量
EN

Stack Overflow用户
提问于 2011-05-31 01:07:24
回答 1查看 107关注 0票数 0

我们公司运营着大量的服务器

我们正在使用一个内部脚本来过滤掉各种信息,前端用户将输入一个邮政编码,然后它将处理一个5页的列表中的1页信息。

注意:我们知道我们的代码可能不是最简单的,但它目前似乎是有效的,任何1知道更简单的方法,然后请说

代码语言:javascript
复制
<?php $postcode = $_POST['postcode']; ?>

// get DOM from URL or file
$html = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=$postcode&x=39&y=9&Page=1');
$html1 = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=$postcode&x=39&y=9&Page=2');
$html2 = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=sa11&x=39&y=9&Page=3'); 

我们还有过滤服务器结果的代码,但是由于某种原因,当我们的一个用户将表单发送到这个脚本时,只返回底部的结果,因为位置是硬编码的-其他的返回时是未知的,我们认为它没有正确地将postcode变量传递给url。

会不会是因为$html变量中已经有了$postcode变量,有没有办法解决这个问题呢?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2011-05-31 01:15:02

字符串beetwen单引号(')不会被计算。试试像这样的东西

代码语言:javascript
复制
$html = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location='.$postcode.'&x=39&y=9&Page=1');
$html1 = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location='.$postcode.'&x=39&y=9&Page=2');

并在程序中使用之前检查$postcode值的有效值,请

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6178997

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档