$string = '/start [email protected]';
$pattern = '/{command} {name}@{domain}';
GET數組參數,可以像下面的例子:如何重寫一個字符串,並在PHP獲得通過模式PARAMS在PHP
['command' => 'start', 'name' => 'info', 'domain' => 'example.com']
和
$string = '/start [email protected]';
$pattern = '/{command} {email}';
['command' => 'start', 'email' => '[email protected]']
和
$string = '/start [email protected]';
$pattern = '{command} {email}';
['command' => '/start', 'email' => '[email protected]']
''/^\ /(?P \ w +)\ s(?P [^ @] +)@(?P 。+?)$ /'',preg_match,例如https://regex101.com/r/jN8gP7/1 –
ArtisticPhoenix
歡迎到StackOverflow。雖然人們可能會猜測你的意思,但我建議在文本中添加明確的問題。 – YakovL