用php提取IP作为JAVASCRIPT变量用提示"缺少';'" <br /><?php<br />function GetIP(){<br /> if(!empty($_SERVER["HTTP_CLIENT_IP"])){<br /> $cip = $_SERVER["HTTP_CLIENT_IP"];<br /> }<br /> elseif(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){<br /> $cip = $_SERVER["HTTP_X_FORWARDED_FOR"];<br /> }<br /> elseif(!empty($_SERVER["REMOTE_ADDR"])){<br /> $cip = $_SERVER["REMOTE_ADDR"];<br /> }<br /> else{<br /> $cip = "无法获取!";<br /> }<br /> return $cip;<br />}<br />?> <br />var frip=<?php echo GetIP()?>;<br />如果不用var frip=;是正常的否则提示function GetIP(){ if(!empty($_SERVER["HTTP_CLIENT_IP"])){缺少“;”------解决方案--------------------var frip="";