<?php
$str = '<?xml version="1.0" encoding="UTF-8"?>
<DATA>
<sessionId>1073741(eA14011269142xC071</sessionId>
<device_id></device_id>
<sessionTime>1429457223</sessionTime>
<trans_time>1429457223</trans_time>
<mpb>1000</mpb>
<user_id>1335</user_id>
<user_name>ltt1835</user_name>
<alias>Lotto8 陈</alias>
<display_user_points>3999</display_user_points>
<message>剩余积分不足, 请充值后再继续。</message>
<transfer_points>0</transfer_points>
<user_points>3999</user_points>
<fund_status>100</fund_status>
<Jackpot>
<jackpot_amount>1582668</jackpot_amount>
<jackpot_ceiling>10000</jackpot_ceiling>
<jackpot_preserved>800000</jackpot_preserved>
<message_front>总奖池目前已经高达</message_front>
<message_mid>分,大奖随时开出,多玩多赢。</message_mid>
<message_end></message_end>
<message_top>两次开奖,奖上有奖,喜上加喜</message_top>
</Jackpot>
<card_number>1073741835</card_number>
<status>1</status>
</DATA>';
print_r( get_tag("status", 1, $str));
function get_tag( $attr, $value, $xml, $tag=null ) {
if( is_null($tag) )
$tag = '\w+';
else
$tag = preg_quote($tag);
$attr = preg_quote($attr);
$value = preg_quote($value);
$tag_regex = "/<(".$tag.")[^>]*$attr\s*=\s*".
"(['\"])$value\\2[^>]*>(.*?)<\/\\1>/";
preg_match_all($tag_regex,
$xml,
$matches,
PREG_PATTERN_ORDER);
return $matches[3];
}
?>
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- Array
(
)
preferences:
231.47 ms | 406 KiB | 326 Q