INFO_MAP name:"mapname" version:"1.2.3"
INFO_SETTINGS mode:"Mode_Normal" options:"Option_None"
PLAYER_CONNECT player:0 name:"testname" id:1231231 psr:1000.00
PLAYER_TEAM_CHANGE player:0 team:2
ITEM_PURCHASE time:0 x:13906 y:13485 z:110 player:2 team:2 item:"Item_ItemName" cost:250
ABILITY_UPGRADE time:0 x:13906 y:13485 z:110 player:2 team:2 name:"Ability_Example1" level:1 slot:2
ITEM_PURCHASE time:0 x:13869 y:13740 z:110 player:1 team:2 item:"Item_AnotherItem" cost:100
PLAYER_CHAT player:3 target:"team" msg:"Test Message with Spaces"
我有這種風格的遊戲日誌,我必須通過PHP解析。哪些是最有效的方式來獲得有用的東西,目前的strstr + explodes系統真的很糟糕,由以前的開發人員編碼。我正在考慮正則表達式,但無法獲得任何工作。PHP,正則表達式和解析遊戲日誌
如果(的strstr($ log_line,「PLAYER_CONNECT ')) \t { \t \t $ line = explode(「」,$ log_line); \t \t $ id = explode(「:」,$ line [1]); \t \t $ name = explode(「:」,$ line [2]); – user1097445
日誌總計高達10000-15000行。 – user1097445
爆炸問題(「」,$ line)是PLAYER_CHAT player:3 target:「team」msg:「帶空格的測試消息」< - msg:部分爆炸太多次 – user1097445