Home >Backend Development >PHP Tutorial >PHP message matching
There is an information template, such as:
"Name: @, phone number @, please notify this person"
The @ is a variable that needs to be modified, fill in the information, and become
<code>"姓名:小明,电话:15888888888,请通知此人" </code>
How can I tell whether the modified template uses the previous template?
There is an information template, such as:
"Name: @, phone number @, please notify this person"
The @ is a variable that needs to be modified, fill in the information, and become
<code>"姓名:小明,电话:15888888888,请通知此人" </code>
How can I tell whether the modified template uses the previous template?
Regular replacement preg_replace :xxx,
Replace with:@,
<code>$a = "姓名:小明,电话:15888888888,请通知此人"; var_dump(preg_replace('/:([^<]*?),/is',':@,',$a));</code>
Then compare it with your message template.