空间开设多个站点的方法

学生党
对于大款,可略过,学生党可以这么干
在thinkphp的入口文件中这样定义:
  1. // 检测PHP环境
  2. if(version_compare(PHP_VERSION,'5.3.0','<'))  die('require PHP > 5.3.0 !');
  3. // 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
  4. // define('APP_DEBUG',true);
  5. // 定义应用目录
  6. if (strpos($_SERVER['HTTP_HOST'], 'www.')===0) {
  7.     define('APP_PATH','./Application/'.substr($_SERVER['HTTP_HOST'], 4).'/');
  8. }else{
  9.     define('APP_PATH','./Application/'.$_SERVER['HTTP_HOST'].'/');
  10. }
  11. // define('APP_PATH','./Application/');
  12. // 定义运行时目录
  13. // define('RUNTIME_PATH', './Runtime/');
  14. // 引入ThinkPHP入口文件
  15. require './ThinkPHP/ThinkPHP.php';
  16. // 亲^_^ 后面不需要任何代码了 就是如此简单
复制代码
我就是这么干的,多个网站用一个虚拟服务器