public function createAPP()
 {
     if (!IS_POST) {
         $this->error('非法请求');
     }
     $this->setIndex();
     chdir($this->appinfo['BASE_DIR']);
     //chdir改变工作目录以后执行realpath获取app_path
     //以下三行为写入applist.xml的三个属性
     $this->app_name = $this->appinfo['project'];
     $this->app_path = CheckConfig::dirModifier(realpath($this->appinfo['APP_PATH']));
     $this->app_index = $this->appinfo['BASE_DIR'] . $this->appinfo['INDEX_FILE'];
     chdir(APP_PATH);
     //恢复工作目录到TP助手主目录
     if (!$this->updateAPP()) {
         //写入applist.xml
         $this->assign('error_list', $this->error);
         $this->error('啊欧~出错啦!');
         return;
     }
     //创建入口文件
     $this->bulidIndex();
     //构造入口文件的url
     $wwwroot = CheckConfig::dirmodifier($_SERVER['DOCUMENT_ROOT']);
     $localhost = strtr($this->appinfo['BASE_DIR'], array($wwwroot => "http://" . $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . '/'));
     //访问入口文件
     $content = file_get_contents($localhost . $this->appinfo['INDEX_FILE']);
     //更新cookie
     cookie('config_path', $this->app_path . 'Conf/config.php');
     cookie('base_dir', $this->appinfo['BASE_DIR']);
     cookie('app_name', $this->app_name);
     cookie('app_index', $this->app_index);
     cookie('app_url', $localhost . $this->appinfo['INDEX_FILE']);
     cookie('switch', 'on', 0);
     cookie('think_path', CheckConfig::dirModifier(THINK_PATH));
     cookie('tp_helper', CheckConfig::dirModifier(APP_PATH));
     if ($content === false) {
         $this->success('入口文件创建成功,从浏览器访问该文件以创建项目结构');
     } else {
         $this->success('项目创建完成,即将返回首页', U('Index/index'));
     }
 }