dongxiai3003 2017-01-08 00:51
浏览 36
已采纳

WAMP虚拟主机不包含域

I'm using WAMP, with a virtual host. The problem is that when I'm on my virtual host,

$_SERVER['REQUEST_URI']

contains only a "/" when I'm on the index; it doesn't contain the domain name. Why?

  • 写回答

1条回答 默认 最新

  • drny60365 2017-01-08 01:24
    关注

    Yes, the REQUEST_URI is not supposed to contain the host, only the part after the host and before the query string. Use:

    $_SERVER['HTTP_HOST']
    

    Or:

    $_SERVER['SERVER_NAME']
    

    HTTP_HOST is the one that was specified in the request header (the actual host being visited). SERVER_NAME is the one that is set up as the ServerName on the virtual host. Not always the same as each other if coming in on a ServerAlias.

    References:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法