如何使用 php 进入嵌套大括号内?
例子:
{{ text1 {{text2 text3 {{text4}} text5}} }}
应该输出
1- text1 {{text2 text3 {{text4}} text5}}
2- text2 text3 {{text4}} text5
3- text4
最佳答案
这需要跟踪括号的数量,不能使用正则表达式来完成。您必须为此创建自己的解析器逻辑。 Regex is not a parser ,对不起。
Here is another similar question with the same response as mine
And here is a SO about building parses (in Java, but it should translate well enough)
关于php - 如何获取大括号内的嵌套值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11294144/