php 代码技巧

it2024-03-24  74

字符串模板化

$name = 'tanrx'; $msgContent = "hello, ${name}"; eval( "\$msgContent = \"$msgContent\";" ); 输出  hello, tanrx

 

提取$和花括弧的字符正则表达式

"/(?:\\$\{)([^{}$]*)(?:\})/"

 

 

 

最新回复(0)