gpt4 book ai didi

php - $_SERVER ['SERVER_ADDR' ] 可以安全依赖吗?

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:57:03 25 4
gpt4 key购买 nike

我的站点严重依赖于 $_SERVER['SERVER_ADDR']。我可以信任检索到的数据吗?有没有可能找到空字符串?

最佳答案

我引用了一些php引用

这似乎取决于托管 PHP 的服务器(尤其是 apache , IIS ...)

http://php.net/manual/en/reserved.variables.server.php

On Windows IIS 7 you must use $_SERVER['LOCAL_ADDR'] rather than $_SERVER['SERVER_ADDR'] to get the server's IP address.

还有一个。

Windows running IIS v6 does not include $_SERVER['SERVER_ADDR']

If you need to get the IP addresse, use this instead:

<?php $ipAddress =
gethostbyname($_SERVER['SERVER_NAME']);
?>

关于php - $_SERVER ['SERVER_ADDR' ] 可以安全依赖吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5705082/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com