在PHP代码运行之前从头设置IP
问题描述:
Since i dont want to change openx coding and i wanna to set the IP from header to the php $_SERVER['REMOTE_ADDR']
Is there any way to extract a IP from header (pre-set by other program already in load balancing web server) before any php code running?
因为我不想改变openx编码,我想把IP从头部设置为php $ _SERVER [' REMOTE_ADDR'] p>
在运行任何php代码之前,有没有办法从头文件中提取IP(由负载均衡Web服务器中的其他程序预先设置)? p> div>
答
You can't set $_SERVER['REMOTE_ADDR'] before PHP wrapper does (cgi/module). But using the .htaccess php_value "auto_prepend_file", you can request a script to be executed before anything else, and this way, you're free to set $_SERVER['REMOTE_ADDR'] with anything you want in it.