<TR id=J-item-1 class="J-item " sizset="53" sizcache="3">
<TD class=time>
<P class=time-d>
2015.07.18
</P>
</TD>
<TD class=memo sizset="53" sizcache="3">
<A id=J-memo-trigger-1 class="record-icon icon-memo J-memo-trigger" href="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150718200040011100640031064039&createDate=			20150718110348	&bizType=D_TRANSFER"
seed="memo-JMemoTrigger1" smartracker="on" jQuery17206151074297958363="11">
</A>
<DIV id=J-memo-cnt-1 class="fn-hide content-memo">
<DIV class=fn-clear>
<LABEL class=fn-left>
备注:
</LABEL>
<P class=memo-info>
还钱还钱~
</P>
</DIV>
<DIV class=security-tips>
请勿备注个人敏感信息
</DIV>
</DIV>
</TD>
<TD class=name sizset="54" sizcache="3">
<P class=consume-title sizset="54" sizcache="3">
<A title=还钱还钱~ href="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150718200040011100640031064039"
target=_blank seed="consumeTitle-link" smartracker="on">
还钱还钱~
</A>
</P>
</TD>
<TD class=amount>
<SPAN class=amount-pay-in>
+2000.00
</SPAN>
</TD>
<TD class=detail>
</TD>
<TD class=status>
<P>
交易成功
</P>
<P class=ft-gray>
</P>
</TD>
<TD class=action>
<SELECT id=J-operation-select-1 class="fn-hide J-operation-select" seed="action-JOperationSelect1"
smartracker="on">
<OPTION selected data-target="_blank" data-link="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150718200040011100640031064039">
详情
</OPTION>
<OPTION class=split seed="trade-memo" data-link="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150718200040011100640031064039&createDate=			20150718110348 	&bizType=D_TRANSFER"
data-tip="请勿备注个人敏感信息" rel-id="" data-action="edit-memo">
备注
</OPTION>
<OPTION seed="trade-delete" data-link="https://consumeprod.alipay.com:443/record/delete.json?record=			2015-07-18 11:03:48 	|20150718200040011100640031064039|D_TRANSFER"
rel-id="" data-action="delete" data-fund-change="true">
删除
</OPTION>
</SELECT>
<DIV id=J-operation-menu-1 class="operation-menu-trigger J-operation-menu-trigger"
jQuery17206151074297958363="32">
<DIV class=current-item>
<SPAN class=item-text>
详情
</SPAN>
<SPAN class=icon-pull-down>
</SPAN>
</DIV>
</DIV>
</TD>
</TR>
<TR id=J-item-2 class="J-item split " sizset="55" sizcache="3">
<TD class=time>
<P class=time-d>
2015.07.17
</P>
</TD>
<TD class=memo sizset="55" sizcache="3">
<A id=J-memo-trigger-2 class="record-icon icon-memo J-memo-trigger" href="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150717200040011100120030908656&createDate=			20150717201424	&bizType=D_TRANSFER"
seed="memo-JMemoTrigger2" smartracker="on" jQuery17206151074297958363="16">
</A>
<DIV id=J-memo-cnt-2 class="fn-hide content-memo">
<DIV class=fn-clear>
<LABEL class=fn-left>
备注:
</LABEL>
<P class=memo-info>
私人借款
</P>
</DIV>
<DIV class=security-tips>
请勿备注个人敏感信息
</DIV>
</DIV>
</TD>
<TD class=name sizset="56" sizcache="3">
<P class=consume-title sizset="56" sizcache="3">
<A title=私人借款 href="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150717200040011100120030908656"
target=_blank seed="consumeTitle-linkT1" smartracker="on">
私人借款
</A>
</P>
</TD>
<TD class=amount>
<SPAN class=amount-pay-out>
-2000.00
</SPAN>
</TD>
<TD class=detail sizset="57" sizcache="3">
<A onclick="return false;" class="J-amount-more mr-10 record-icon icon-detail J-details-trigger"
href="https://consumeprod.alipay.com:443/record/funditem.json?bizType=D_TRANSFER&bizInNo=20150717200040011100120030908656&gmtBizCreate=			20150717201424	"
seed="trade-details" jQuery17206151074297958363="25">
</A>
</TD>
<TD class=status>
<P>
交易成功
</P>
<P class=ft-gray>
</P>
</TD>
<TD class=action>
<SELECT id=J-operation-select-2 class="fn-hide J-operation-select" seed="action-JOperationSelect2"
smartracker="on">
<OPTION selected data-target="_blank" data-link="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150717200040011100120030908656">
详情
</OPTION>
<OPTION class=split seed="trade-memo" data-link="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150717200040011100120030908656&createDate=			20150717201424 	&bizType=D_TRANSFER"
data-tip="请勿备注个人敏感信息" rel-id="" data-action="edit-memo">
备注
</OPTION>
<OPTION seed="trade-delete" data-link="https://consumeprod.alipay.com:443/record/delete.json?record=			2015-07-17 20:14:24 	|20150717200040011100120030908656|D_TRANSFER"
rel-id="" data-action="delete" data-fund-change="true">
删除
</OPTION>
</SELECT>
<DIV id=J-operation-menu-2 class="operation-menu-trigger J-operation-menu-trigger"
jQuery17206151074297958363="35">
<DIV class=current-item>
<SPAN class=item-text>
详情
</SPAN>
<SPAN class=icon-pull-down>
</SPAN>
</DIV>
</DIV>
</TD>
</TR>
<TR id=J-item-3 class="J-item " sizset="58" sizcache="3">
<TD class=time>
<P class=time-d>
2015.07.17
</P>
</TD>
<TD class=memo>
</TD>
<TD class=name sizset="58" sizcache="3">
<P class=consume-title sizset="58" sizcache="3">
<A title=转账 href="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150717200040011100200030848594"
target=_blank seed="consumeTitle-linkT2" smartracker="on">
转账
</A>
</P>
</TD>
<TD class=amount>
<SPAN class=amount-pay-in>
+2000.00
</SPAN>
</TD>
<TD class=detail>
</TD>
<TD class=status>
<P>
交易成功
</P>
<P class=ft-gray>
</P>
</TD>
<TD class=action>
<SELECT id=J-operation-select-3 class="fn-hide J-operation-select" seed="action-JOperationSelect3"
smartracker="on">
<OPTION selected data-target="_blank" data-link="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150717200040011100200030848594">
详情
</OPTION>
<OPTION class=split seed="trade-memo" data-link="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150717200040011100200030848594&createDate=			20150717201338 	&bizType=D_TRANSFER"
data-tip="请勿备注个人敏感信息" rel-id="" data-action="edit-memo">
备注
</OPTION>
<OPTION seed="trade-delete" data-link="https://consumeprod.alipay.com:443/record/delete.json?record=			2015-07-17 20:13:38 	|20150717200040011100200030848594|D_TRANSFER"
rel-id="" data-action="delete" data-fund-change="true">
删除
</OPTION>
</SELECT>
<DIV id=J-operation-menu-3 class="operation-menu-trigger J-operation-menu-trigger"
jQuery17206151074297958363="38">
<DIV class=current-item>
<SPAN class=item-text>
详情
</SPAN>
<SPAN class=icon-pull-down>
</SPAN>
</DIV>
</DIV>
</TD>
</TR>
<TR id=J-item-4 class="J-item split " sizset="59" sizcache="3">
<TD class=time>
<P class=time-d>
2015.07.15
</P>
</TD>
<TD class=memo>
</TD>
<TD class=name sizset="59" sizcache="3">
<P class=consume-title sizset="59" sizcache="3">
<A title=提现-快速提现 href="https://shenghuo.alipay.com/transfercore/withdraw/withdrawDetail.htm?billNo=20150715200040011100120030294289"
target=_blank seed="consumeTitle-linkT3" smartracker="on">
提现-快速提现
</A>
</P>
</TD>
<TD class=amount>
<SPAN class=amount-pay-out>
-2000.00
</SPAN>
</TD>
<TD class=detail>
</TD>
<TD class=status>
<P>
交易成功
</P>
<P class=ft-gray>
</P>
</TD>
<TD class=action>
<SELECT id=J-operation-select-4 class="fn-hide J-operation-select" seed="action-JOperationSelect4"
smartracker="on">
<OPTION selected data-target="_blank" data-link="https://shenghuo.alipay.com/transfercore/withdraw/withdrawDetail.htm?billNo=20150715200040011100120030294289">
详情
</OPTION>
<OPTION class=split seed="trade-memo" data-link="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150715200040011100120030294289&createDate=			20150715181828 	&bizType=D_TRANSFER"
data-tip="请勿备注个人敏感信息" rel-id="" data-action="edit-memo">
备注
</OPTION>
<OPTION seed="trade-delete" data-link="https://consumeprod.alipay.com:443/record/delete.json?record=			2015-07-15 18:18:28 	|20150715200040011100120030294289|D_TRANSFER"
rel-id="" data-action="delete" data-fund-change="true">
删除
</OPTION>
<OPTION seed="download-receipt" data-target="_self" data-link="https://consumeprod.alipay.com:443/voucher/produce.htm?voucherType=receipt&requestString=D_TRANSFER%3B20150715200040011100120030294289%3B1436955508000">
电子回单
</OPTION>
</SELECT>
<DIV id=J-operation-menu-4 class="operation-menu-trigger J-operation-menu-trigger"
jQuery17206151074297958363="41">
<DIV class=current-item>
<SPAN class=item-text>
详情
</SPAN>
<SPAN class=icon-pull-down>
</SPAN>
</DIV>
</DIV>
</TD>
</TR>
<TR id=J-item-5 class="J-item " sizset="60" sizcache="3">
<TD class=time>
<P class=time-d>
2015.07.15
</P>
</TD>
<TD class=memo>
</TD>
<TD class=name sizset="60" sizcache="3">
<P class=consume-title sizset="60" sizcache="3">
<A title=转账 href="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150715200040011100200030203901"
target=_blank seed="consumeTitle-linkT4" smartracker="on">
转账
</A>
</P>
</TD>
<TD class=amount>
<SPAN class=amount-pay-in>
+3000.00
</SPAN>
</TD>
<TD class=detail>
</TD>
<TD class=status>
<P>
交易成功
</P>
<P class=ft-gray>
</P>
</TD>
<TD class=action>
<SELECT id=J-operation-select-5 class="fn-hide J-operation-select" seed="action-JOperationSelect5"
smartracker="on">
<OPTION selected data-target="_blank" data-link="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150715200040011100200030203901">
详情
</OPTION>
<OPTION class=split seed="trade-memo" data-link="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150715200040011100200030203901&createDate=			20150715174951 	&bizType=D_TRANSFER"
data-tip="请勿备注个人敏感信息" rel-id="" data-action="edit-memo">
备注
</OPTION>
<OPTION seed="trade-delete" data-link="https://consumeprod.alipay.com:443/record/delete.json?record=			2015-07-15 17:49:51 	|20150715200040011100200030203901|D_TRANSFER"
rel-id="" data-action="delete" data-fund-change="true">
删除
</OPTION>
</SELECT>
<DIV id=J-operation-menu-5 class="operation-menu-trigger J-operation-menu-trigger"
jQuery17206151074297958363="44">
<DIV class=current-item>
<SPAN class=item-text>
详情
</SPAN>
<SPAN class=icon-pull-down>
</SPAN>
</DIV>
</DIV>
</TD>
</TR>
<TR id=J-item-6 class="J-item split " sizset="61" sizcache="3">
<TD class=time>
<P class=time-d>
2015.07.15
</P>
</TD>
<TD class=memo>
</TD>
<TD class=name sizset="61" sizcache="3">
<P class=consume-title sizset="61" sizcache="3">
<A title="淘宝购物-PUKKA折叠迷你电动滑板车 成人电动车代驾代步锂电动自行车电瓶车" href="https://lab.alipay.com/consume/queryTradeDetail.htm?tradeNo=2015071521001001120211456668"
target=_blank seed="consumeTitle-linkT5" smartracker="on">
淘宝购物-PUKKA折叠迷你电动滑板车 成人电动车代驾代步锂电动自行车电瓶车
</A>
</P>
</TD>
<TD class=amount>
<SPAN class=amount-pay-out>
-2270.00
</SPAN>
</TD>
<TD class=detail sizset="62" sizcache="3">
<A onclick="return false;" class="J-amount-more mr-10 record-icon icon-detail J-details-trigger"
href="https://consumeprod.alipay.com:443/record/funditem.json?bizType=TRADE&bizInNo=2015071521001001120211456668&gmtBizCreate=			20150715174853	"
seed="trade-details" jQuery17206151074297958363="27">
</A>
</TD>
<TD class=status>
<P>
等待确认收货
</P>
<P class=ft-gray>
</P>
</TD>
<TD class=action>
<SELECT id=J-operation-select-6 class="fn-hide J-operation-select" seed="action-JOperationSelect6"
smartracker="on">
<OPTION selected seed="confirm-goods" data-target="_blank" data-link="https://lab.alipay.com/consume/queryTradeDetail.htm?actionName=CONFIRM_GOODS&tradeNo=2015071521001001120211456668">
确认收货
</OPTION>
<OPTION seed="trade-refund" data-target="_blank" data-link="https://lab.alipay.com/consume/queryTradeDetail.htm?actionName=APPLY_REFUND&tradeNo=2015071521001001120211456668">
退款
</OPTION>
<OPTION disabled seed="long-time" data-link="javascript:void(0)" data-tip="您可以联系卖家为您延长确认收货时间">
延长时间
</OPTION>
<OPTION seed="trade-detail" data-target="_blank" data-link="https://lab.alipay.com/consume/queryTradeDetail.htm?tradeNo=2015071521001001120211456668">
详情
</OPTION>
<OPTION class=split seed="trade-memo" data-link="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=2015071521001001120211456668&createDate=			20150715174853 	&bizType=TRADE"
data-tip="请勿备注个人敏感信息" rel-id="" data-action="edit-memo">
备注
</OPTION>
<OPTION seed="trade-delete" data-link="https://consumeprod.alipay.com:443/record/delete.json?record=			2015-07-15 17:48:53 	|2015071521001001120211456668|TRADE"
rel-id="" data-action="delete" data-fund-change="true">
删除
</OPTION>
</SELECT>
<DIV id=J-operation-menu-6 class="operation-menu-trigger J-operation-menu-trigger operation-menu-trigger-hot"
jQuery17206151074297958363="47">
<DIV class=current-item>
<SPAN class=item-text>
确认收货
</SPAN>
<SPAN class=icon-pull-down>
</SPAN>
</DIV>
</DIV>
</TD>
</TR>
<TR id=J-item-7 class="J-item " sizset="63" sizcache="3">
<TD class=time>
<P class=time-d>
2015.07.14
</P>
</TD>
<TD class=memo sizset="63" sizcache="3">
<A id=J-memo-trigger-7 class="record-icon icon-memo J-memo-trigger" href="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150714200040011100120030144108&createDate=			20150714230734	&bizType=D_TRANSFER"
seed="memo-JMemoTrigger7" smartracker="on" jQuery17206151074297958363="21">
</A>
<DIV id=J-memo-cnt-7 class="fn-hide content-memo">
<DIV class=fn-clear>
<LABEL class=fn-left>
备注:
</LABEL>
<P class=memo-info>
美满幸福
</P>
</DIV>
<DIV class=security-tips>
请勿备注个人敏感信息
</DIV>
</DIV>
</TD>
<TD class=name sizset="64" sizcache="3">
<P class=consume-title sizset="64" sizcache="3">
<A title=美满幸福 href="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150714200040011100120030144108"
target=_blank seed="consumeTitle-linkT6" smartracker="on">
美满幸福
</A>
</P>
</TD>
<TD class=amount>
<SPAN class=amount-pay-out>
-6666.66
</SPAN>
</TD>
<TD class=detail sizset="65" sizcache="3">
<A onclick="return false;" class="J-amount-more mr-10 record-icon icon-detail J-details-trigger"
href="https://consumeprod.alipay.com:443/record/funditem.json?bizType=D_TRANSFER&bizInNo=20150714200040011100120030144108&gmtBizCreate=			20150714230734	"
seed="trade-details" jQuery17206151074297958363="29">
</A>
</TD>
<TD class=status>
<P>
交易成功
</P>
<P class=ft-gray>
</P>
</TD>
<TD class=action>
<SELECT id=J-operation-select-7 class="fn-hide J-operation-select" seed="action-JOperationSelect7"
smartracker="on">
<OPTION selected data-target="_blank" data-link="https://shenghuo.alipay.com/send/queryTransferDetail.htm?tradeNo=20150714200040011100120030144108">
详情
</OPTION>
<OPTION class=split seed="trade-memo" data-link="https://consumeprod.alipay.com:443/record/editMemo.htm?bizInNo=20150714200040011100120030144108&createDate=			20150714230734 	&bizType=D_TRANSFER"
data-tip="请勿备注个人敏感信息" rel-id="" data-action="edit-memo">
备注
</OPTION>
<OPTION seed="trade-delete" data-link="https://consumeprod.alipay.com:443/record/delete.json?record=			2015-07-14 23:07:34 	|20150714200040011100120030144108|D_TRANSFER"
rel-id="" data-action="delete" data-fund-change="true">
删除
</OPTION>
</SELECT>
<DIV id=J-operation-menu-7 class="operation-menu-trigger J-operation-menu-trigger"
jQuery17206151074297958363="51">
<DIV class=current-item>
<SPAN class=item-text>
详情
</SPAN>
<SPAN class=icon-pull-down>
</SPAN>
</DIV>
</DIV>
</TD>
</TR>
<?php
header("content-type:text/html;charset=utf-8;");
$str = file_get_contents(‘./reg.html‘);
$arr = array();
//匹配出每一行的数据的html字符串
preg_match_all(‘/<TR id=J-item-\d{1}[\s\S]*?<\/TR>/‘,$str,$revals);
for($i=0;$i<count($revals[0]);$i++){
$t = $revals[0][$i];
//匹配交易时间
preg_match(‘/\b\d{4}\.\d{2}\.\d{2}\b/‘, $t,$a);
$a = $a[0];
//交易类型
preg_match(‘/<A title=[\s\S]*?<\/A>/‘, $t,$b);
$b = preg_split("/[><]+/", $b[0]);
$b = trim($b[2]);
//匹配金额
preg_match(‘/[-|+]\d{0,}\.\d{2}/‘, $t,$c);
$c = $c[0];
//交易状态
preg_match(‘/<P>[\s\S]*?<\/P>/‘, $t,$d);
$d = preg_split("/[><]+/", $d[0]);
$d = trim($d[2]);
//封装到数组里
$tmp = array(‘交易时间‘ => $a, ‘交易类型‘=> $b,‘交易金额‘=> $c,‘交易状态‘=> $d);
array_push($arr, $tmp);
//echo $a .‘<br>‘.$b.‘<br>‘.$c.‘<br>‘.$d;
//echo ‘<hr >‘;
}
echo ‘<pre>‘;
print_r($arr);
echo ‘</pre>‘;
版权声明:本文为博主原创文章,未经博主允许不得转载。
PHP使用正则表达式分离出HTML里我们所需的数据,封装到二维数组里
原文地址:http://blog.csdn.net/u014044821/article/details/46954713