Parsing Valve Data Format files in PHP

后端 未结 2 1249
暗喜
暗喜 2021-01-23 14:45

I am completely stuck in how to start parsing these kind of files in PHP. These are some sort of arrays with variable amount of sub-arrays. https://developer.valvesoftware.com/w

相关标签:
2条回答
  • 2021-01-23 15:19

    Late answer, but just saw this. The data on question is in (Valve Data Format)[https://developer.valvesoftware.com/wiki/KeyValues], also called KeyValues format, and is very reminiscence of JSON.

    About a year ago I wrote this script which can convert VDF data to valid JSON. You can use it once and store the generated JSON or call it anytime you need JSON from VDF.

    https://gist.github.com/AlienHoboken/5571903

    0 讨论(0)
  • 2021-01-23 15:28

    There an online one I found. http://rossengeorgiev.github.io/vdf-parser/

    The repo has a js and python implementations, it shouldn't be too hard to port them to PHP.

    0 讨论(0)
提交回复
热议问题