如何以这种确切的格式添加电子邮件地址的通配符


How to add wildcard for email address in this exact format?

在这行if ($email != "user@domain.com")中,我如何将"user"更改为通配符?代码必须具有if ($email !=的确切开始格式,以便与我的脚本集成。

你不能。
!=运算符检查的确切值。
PHP中没有字符串通配符

可以使用substr:

if( substr($email, -11, 11) != "@domain.com" )

或正则表达式:

if( preg_match('/@domain.com$/iu',$email) )

参考PHP手册中的substr和preg_match。