php 在windows下配置虚拟目录的方法介绍

yipeiwu_com6年前PHP代码库
先打开Apache的conf目录下的httpd.conf文件,在末尾添加如下代码:
复制代码 代码如下:

<VirtualHost *:80>
 ServerName www.mydemo.com
 DocumentRoot "D:/mydemo"
<Directory "D:/mydemo">
 Options FollowSymLinks IncludesNOEXEC Indexes
 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
 AllowOverride Options FileInfo
 Order Deny,Allow
 Allow from all
</Directory>
</VirtualHost>

再到C:->Windows->System32->drivers->etc目录,打开hosts文件。
在末尾添加如下代码:
复制代码 代码如下:

127.0.0.1 www.mydemo.com

然后再创建D:\mydemo目录
再然后重启一下apache服务器。
在浏览器输入www.mydemo.com看看

相关文章

彻底杜绝PHP的session cookie错误

只要你写过PHP代码,相信都遇上过这个大多时候都令人莫明其妙的warning吧..今天我们就来搞定它...............   看了PHP手册,回答如下:   消息“Warnin...

php 中奖概率算法实现代码

实现代码: <?php /** *php 中奖概率算法 * */ function get_zj( $jp ,$glname = 'gl'){ $sum = 0...

探讨方法的重写(覆载)详解

复制代码 代码如下:<?php class Cart{  public function Cart(){   echo...

php iconv() : Detected an illegal character in input string

开始是这样用的$str = iconv('UTF-8', 'GB2312', unescape(isset($_GET['str'])? $_GET['str']:''));上线后报一堆...

php基于自定义函数记录log日志方法

本文实例讲述了php基于自定义函数记录log日志方法。分享给大家供大家参考,具体如下: /** * 记录错误日志 * @param 日志内容 $res */ function...