使用dreamweaver编写php文件时,为什么在localhost下无法运行文件,而在127.0.01下可以运行?例如:在http://localhost/test.php下无法看到运行结果,而在http://127.0.0.1/test.php下就可以?

解决方案 »

  1.   

    跟你站点的环境配置有关吧,不知道是用IIS+PHP,还是APPACHE+PHP,从配置首手,可以先打开DW的站点管理选项夹查看。
      

  2.   

    C:\WINDOWS\system32\drivers\etc
    system32下面的driver目录下面的etc目录里面,有hosts这个文件,修改内容就可以了127.0.0.1       localhost
      

  3.   

    关于3楼 的说法,hosts文件内容为:# Copyright (c) 1993-1999 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host127.0.0.1       localhost
      

  4.   

    dw 站点管理里面把站点的url 改成http://127.0.0.1/就可以了
      

  5.   

    分别ping localhost和127.0.0.1一般情况下ping localhost 应该为127.0.0.1如果不一样,可能是IPV6协议将127.0.0.1解析为 ::1   (127.0.0.1 ipv6的形式)解决:
    win->cmdipv6 uninstall    
      

  6.   

    你建立的站點的url寫的是:http://127.0.0.1/...
    也可以修改成:http://localhost/...