用于getmxrr的PHP文档将语法指定为:
bool getmxrr ( string $hostname , array &$mxhosts [, array &$weight ] )
此功能不会折旧(不会替换为更受欢迎的功能)。但是,当使用所述的函数时,我收到以下警告:
已弃用:调用时按引用传递已弃用路径/到/脚本在第 n 行
那么,应该如何使用这个实用程序而不会引起PHP的抱怨呢?
语言对自己的处方皱眉是不是很荒谬?
这不是你应该怎么称呼它;该函数声明引用,它不应该在调用时使用。
$mxhosts = $weight = array(); // not really necessary but good for form :)
$res = getmxrr('example.com', $mxhosts, $weight);
// $mxhosts and $weight are populated
另请参阅:http://php.net/manual/en/language.references.pass.php