我有一个PHP的要求,
在生物识别机器中,URL将像这样传递:
Website.com/rfid/sistance.php?- Web主机URL
$ - Start of data
SID= XXXXX - Org ID (5 digits)
& - Field Differentiator
MID= XX - Machine ID (2 digits)
&
RFID= XXXXXXXXXX - Card ID (10 numeric digits User ID)
&
DOT=DDMMYYYYHHMMSS- Date of Transaction (14 digits)
, - End of one record
* - End of data如果一条记录一次上传:
http://website.com/rfid/attendance.php?$99999&99&0008478100&27122013113700*如果两个记录一次上传:
http://website.com/rfid/rfid_device.php?$99999&99&0008478100&27122013113700, 0008478200&27122013113700*当10张唱片一次上传时:
/rfid/rfid_device.php?0000000000000000$99999&99&0008478100&27122013113700,1234567100&27122013113700,1234567200&27122013113700,123456700&27122013113700,1234567200&27122013113700,1234567100&27122013113700,1234567100&27122013113700,1234567200&27122013113700,1234567100&27122013113700,1234567200&27122013113700*如何获得商店价值?请帮帮忙。
发布于 2014-11-21 16:22:44
你可以用$_SERVER['QUERY_STRING']超级,然后用explode()分解字符串.
http://php.net/manual/en/reserved.variables.server.php
http://php.net/manual/en/function.explode.php
更新:
未经测试的代码示例:(应该注意,我不记得超级程序是否包括“?”)查询字符串中的。)
$qs = str_replace('$', '', $_SERVER['QUERY_STRING']); // get rid of the $
$qs = str_replace('*', '', $qs); // get rid of the *
$submissions = explode(',', $qs); // split the subs
$SID = ""; // store for sid
$MID = ""; // store for mid
// loop
for ($i = 0; $i < count($submissions); $i++) {
$sections = explode('&', $submissions[$i]);
if($i == 0) {
$SID = $sections[0];
$MID = $sections[1];
$RFID = $sections[2];
$DOT = $sections[3];
} else {
$RFID = $sections[0];
$DOT = $sections[1];
}
// do things with the values
}发布于 2014-11-21 16:32:21
PHP还建议使用Filter而不是直接访问$_*变量。
$querystr = filter_input( INPUT_SERVER, 'QUERY_STRING' );http://php.net/manual/en/function.filter-input.php
https://stackoverflow.com/questions/27065790
复制相似问题