private static function init($app) { defined('DAGGER_DEBUG') && BaseModelCommon::debug($app, 'router_choose_app'); //app的基础目录 $base = DAGGER_PATH_APP . $app . '/'; //app的controller目录 $controllerPath = $base . 'controller/'; //app的model目录 $modelPath = $base . 'model/'; //app的pagelet目录 $pageletPath = $base . 'pagelet/'; //app的templates目录 $tempaltePath = $base . 'templates/'; if (DAGGER_PLATFORM == 'sae') { //app的templats_c目录,SAE使用MC $templateCPath = "saemc://smartytpl/" . $app . '/templates_c/'; } else { //app的templats_c目录 $templateCPath = DAGGER_PATH_CACHE . $app . '/templates_c/'; BaseModelCommon::recursiveMkdir($templateCPath); } define('DAGGER_PATH_APP_CTL', $controllerPath); //app的controller define('DAGGER_PATH_APP_MODEL', $modelPath); //app的model define('DAGGER_PATH_APP_PLT', $pageletPath); //app的pagelet define('DAGGER_PATH_APP_TPL', $tempaltePath); //app的templates define('DAGGER_PATH_APP_TPC', $templateCPath); //app的templats_c }
public function writeTo($str) { if (DAGGER_PLATFORM == 'sae') { if ($this->location == 'log') { ini_set("display_errors", "Off"); sae_debug($str); ini_set("display_errors", "On"); } else { throw new BaseModelException("SAE不支持追加写入功能", 90900, 'file_trace'); } } else { $dirName = dirname($this->path); BaseModelCommon::recursiveMkdir($dirName); $fp = fopen($this->path, "a"); $num = fwrite($fp, $str); fclose($fp); return $num; } }