我们公司运营着大量的服务器
我们正在使用一个内部脚本来过滤掉各种信息,前端用户将输入一个邮政编码,然后它将处理一个5页的列表中的1页信息。
注意:我们知道我们的代码可能不是最简单的,但它目前似乎是有效的,任何1知道更简单的方法,然后请说
<?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变量,有没有办法解决这个问题呢?
谢谢
发布于 2011-05-31 01:15:02
字符串beetwen单引号(')不会被计算。试试像这样的东西
$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值的有效值,请
https://stackoverflow.com/questions/6178997
复制相似问题