duandi1636 2013-12-19 21:45
浏览 14
已采纳

发送GET变量而不是“?”

I'm working on a website that is trying to call a link like this:

http://mysite/folder/g=foundation

I'm trying to troubleshoot some Javascript issues.

In the 'folder' subfolder there is an index.php that is looking for a 'g' GET variable.

As far as I'm aware this is incorrect and should be:

http://mysite/folder/?g=foundation

Where that would be sent to index.php in the 'folder' subfolder.

Is the first syntax ok? Is the '?' necessary for maybe having only one GET variable?

NOTE:

This whole site is completely working on a production server. This call works. The version that breaks is on a newer Virtual Machine. Are there any configurations I can make to allow this kind of syntax?

  • 写回答

3条回答 默认 最新

  • doxd96148 2013-12-19 22:21
    关注

    The (?) question mark serves a purpose of indicating the initiation and declaration of query parameters. Excluding it would imply that you have a directory with an equals sign within the name.

    RFC 1738            Uniform Resource Locators (URL)        December 1994
    
    
    3.3. HTTP
    
       The HTTP URL scheme is used to designate Internet resources
       accessible using HTTP (HyperText Transfer Protocol).
    
       The HTTP protocol is specified elsewhere. This specification only
       describes the syntax of HTTP URLs.
    
       An HTTP URL takes the form:
    
          http://<host>:<port>/<path>?<searchpart>
    

    If, however, you must have it your way (without the question mark), you will need to use mod_rewrite.

    To answer you question more literally. Yes. The (?) is necessary.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器